Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Use a query that postgresql optimises better for get_events_around #906
Conversation
NegativeMjark
assigned
erikjohnston
Jul 4, 2016
|
LGTM |
|
@erikjohnston Having looked at how postgres handles the I've switched everything to use lower_bound/upper_bound from the streams.py and made those functions switch on the database engine to decide which format of SQL to use :( |
Can you elaborate? |
erikjohnston
commented on the diff
Jul 5, 2016
| token.topological, "topological_ordering", | ||
| token.topological, "topological_ordering", | ||
| - token.stream, "stream_ordering", | ||
| + token.stream, inclusive, "stream_ordering", |
NegativeMjark
Contributor
|
When I ran that query in a test harness it resulted in a scan over half the index.
Resulted in:
|
|
This presumably still has terrible performance on SQLite? |
Yes. Interestingly SQLite does a reasonable job of optimising the
|
|
So for a sqlite3 database only the UNION ALL form has the desired performance :(
|
|
Complete test harness for postgresql fwiw |
|
@erikjohnston PTAL |
|
LGTM |
NegativeMjark commentedJul 4, 2016
No description provided.