views:

24

answers:

1

Is it possible to cache recently inserted data in MySQL database internally?
I looked at query cache etc (http://dev.mysql.com/doc/refman/5.1/en/query-cache.html) but thats not what I am looking for. I know that 'SELECT' query will be cached.

Details:
I am inserting lots of data to MySQL DB every second.
I have two kind of users for this Data.

  1. Users who query any random data
  2. Users who query recently inserted data

For 2nd kind of users, my table has primary key as unix time-stamp which tells me how new the data is. Is there any way to cache the data at the time of insert?

One option is to write my own caching module which cache data and then 'INSERT'.
Users can query this module before going to MySQL DB.
I was just wondering if something similar is available.

PS: I am open to other database providing similar feature.

A: 

Usually you get the best performance from MySQL if you allow a big index cache (config setting key_buffer_size), at least for MyISAM tables.

If latency is really an issue (as it seems in your case) have a look at Sphinx which has recently introduced real-time indexes.

AndreKR
Sphinx definitely looks good. What I am interested is to have latest data in cache as I know there is gonna be query for that. index cache will be useful to retrieve data faster..
Jack