Making a Postgres query 1k times faster | Hacker News