-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add indexes #113
base: master
Are you sure you want to change the base?
Add indexes #113
Conversation
The error for MySQL seems quite clear, we need to add max_length to the queue_name if we want to index it. But I'm not sure of a reasonable length. I suspect if we're doing that we might as well make it a The sqlite error is also clear, I'm just not sure how to handle it other than with a custom migration, which seems a bit... annoying. I should probably also test if a partial index would work well, maybe we could avoid that or only use that for sqlite. |
64 characters for a queue name ought to be enough for anyone (famous last words, I know...). The SQLite error is very weird, I agree. It reads like an SQL syntax error. If you slowly remove the use of |
I fixed the MySQL issue, though now it looks like there is an issue on some Django versions but not others. I'm not sure if this is just flaky? The SQLite problem is tricker, it doesn't support using nulls last in indexes: https://www.sqlite.org/lang_createindex.html#nulls_first_and_nulls_last I tried running a version of the query (and of the index) that I thought would work for ordering but it actually doesn't get used at all on SQLite for some reason. I suspect it's something to do with how the database is stored on disk but no idea really. So it seems somewhat reasonable at this point to simply not create this index on SQLite. Unfortunately, this seems a bit tricky (especially on train wifi). I will tinker, possibly ask around, and see what I can figure out. I suspect that this solution probably wouldn't fly in core Django though. Possibly a database feature could be added, but it's unclear to me exactly how you'd use it to conditionally create an index. Maybe you have some ideas around this? Otherwise I will poke around. |
I'm also a bit confused by one thing - @RealOrangeOne is there any particular reason |
The reason to use Given 3 tasks, this is the order they'd execute:
|
I had a look at this. Firstly, should
I've just been testing by copying some code from |
Fixes #15
See the ticket for all the initial discussion, but this seems the best bang for the buck at the moment, but would be interested to test with different indexes and data.