Comment 3 for bug 1476429

Revision history for this message
Stuart Bishop (stub) wrote :

In a screen session:

CREATE INDEX CONCURRENTLY oops_oops_prefix_id_date ON oops_oops(prefix_id, date);
ANALYZE oops_oops;

(CONCURRENTLY because this db is live?)

Per what William said, if we can get PostgreSQL to use this index it will work for all these queries, rather than making most of them slower in order to get this edge case working. At the cost of maintaining the index.

There are some other optimization fences we can use too, to avoid PostgreSQL serializing all 56k rows and your app deserializing all 56k rows and tossing most of them away (which is the under the hood behaviour if you are using Python). Is this raw SQL, or which ORM?