Is this insane?

Fi Dot fi.dot.slc at gmail.com
Sun Dec 3 22:30:17 UTC 2006


<skip>
> Using memcache you might instead do "select id from
> mytable where...", then do a "select * from mytable where id = n" for
> each object, but lookup in memcache first, worst case you do n+2
> queries. The only problem here is that cache misses can take your
> query count much higher, so there will have to be a trade-off - the
> number of queries into memcache vs the fact that you know you could
> get the whole lot in a single DB query. So, a naive implemetation
> based solely on getting lists of ids then getting full sets of values
> for individual records would normally give horrific performance, but
> memcache rescues that situation to a large extent. The question is
> how many memcache lookups can you do for the price of that one big
> query, and is it worthwhile? Or am I completely wrong?


Mmm.. maybe im missing the point here, but wouldn't it be better to do
all the lookups, construct one big query for all the data that's
missing, and get it all at once? Then you will have 1 DB query at
most.

Fi.


More information about the memcached mailing list