Hacker News new | ask | show | jobs
by matthewbauer 817 days ago
That sounds like the pg stats are messed up somehow. Try running explain analyze foo to see if it changes things.

Postgres doesn’t automatically create indexes - I bet the others have some implicit index on organization_id, created_at. Otherwise they would be giving bad results in other cases. I don’t see why you can’t just make that index in postgres.

1 comments

>Pg stats are messed up somehow. Try running explain analyze foo

I did

> Postgres doesn’t automatically create indexes

Both fields have indexes (created manually). Postgres is incorrectly choosing the index in order by column, not the index in the where clause.