Hacker News new | ask | show | jobs
by evandwight 1378 days ago
Why not an index on created for speeding up the "new" sort?

What indexes should you create? One for each sort you have?

(I'm just playing around cloning Reddit and running into all sorts of performance problems. Mostly due to celery taking all my memory)

1 comments

Yeah, these are the performance issue solutions. Based on the way open source databases work (clustered indexes), move your indexes to a table that has the sole purpose of indexing, and index everything you sort by index{search constants, then sorting columns, then id }. You can test with your workload, but I found that full covering indexes sat in ram better (so included the id even though not needed).

20yr ago MySQL didn’t have reverse index columns so we had to make (1-timestamp) cols and index those! Also used int for time as it was easier to index back then and you don’t need sub second or anything. Smaller indexes are better.