Thanks for using Lovefield. Just a few comments about the observed performance.
1) Calling connect() more than once is unnecessary and hurts performance. Connecting to the DB invokes reading from IDB and re-creating all in-memory indices. The intended usage is to connect once and then use the same connection to issue queries to the database. If you are only interesting querying the DB once at startup then I understand that keeping a reference to the DB connection around does not help.
The times you are mentioning (400-550ms) correspond to about 20k rows in Lovefield's performance benchmarks (Chrome only) at https://google.github.io/lovefield/dashboard/src/dashboard.html (see "Initialize populated db"). If you are observing these times and have significantly less records in the DB, something else is going wrong and needs investigation.
2) If you are using IDB as Lovefield's backing store, you can greatly reduce the connect() time by using Lovefield's "bundled mode", more details at https://github.com/google/lovefield/blob/master/docs/spec/99_postfix.md#bundled-mode. This trick basically stores multiple records in a single IDB row, which greatly improves read performance (and therefore connect() performance), at the expense of a decrease in write performance.
Comment
Thanks for using Lovefield. Just a few comments about the observed performance.
1) Calling connect() more than once is unnecessary and hurts performance. Connecting to the DB invokes reading from IDB and re-creating all in-memory indices. The intended usage is to connect once and then use the same connection to issue queries to the database. If you are only interesting querying the DB once at startup then I understand that keeping a reference to the DB connection around does not help.
The times you are mentioning (400-550ms) correspond to about 20k rows in Lovefield's performance benchmarks (Chrome only) at https://google.github.io/lovefield/dashboard/src/dashboard.html (see "Initialize populated db"). If you are observing these times and have significantly less records in the DB, something else is going wrong and needs investigation.
2) If you are using IDB as Lovefield's backing store, you can greatly reduce the connect() time by using Lovefield's "bundled mode", more details at https://github.com/google/lovefield/blob/master/docs/spec/99_postfix.md#bundled-mode. This trick basically stores multiple records in a single IDB row, which greatly improves read performance (and therefore connect() performance), at the expense of a decrease in write performance.