top | item 32698347

(no title)

evandwight | 3 years 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)

discuss

order

sroussey|3 years ago

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.