MySQL InnoDB Clustered Indexes and Rails (or How RescueTime Avoided Buying More Hardware)
joehruska.com
joehruska.com
In this case, that extra 'expense' was easily off-set by the savings giving a great speed up. It does teach a good lesson though, which is index as little as possible by using composite indexes where you can!
In databases its amazing how 1 bad table/query/index can hose the performance of the either database - and once you find it, you get such a performance boost!
1. Buffer inserts on two levels: a. In-memory at the application level (if it crashes and you lose a few seconds' worth of data, it is not the end of the world). You can now do bulk inserts. b. Use MySQL's delayed insert buffer.
2. Split the data into separate tables for each duration interval so that you don't have one massive table.
2) This is a great idea for time based data. You age out the tables and create a merge table which is a logical view of all the tables together. You can get tricky and use compressed myisam tables for the older, static data since it will never change.