[Fixed]-Does Django QuerySet use binary search to filter by date?

1👍

âś…

It all depends on the database you’re using. In most databases, there’s an implicit “natural ordering” of rows: when the row was inserted into the database. This might be how it’s displaying, which doesn’t guarantee ordering.

If you’re concerned with computation time, you can place an index on history_date, so grabbing an ordered list is O(log(n)) time. However, inserting, updating, and deleting will take slightly longer!

Leave a comment