Altering queries?

Dustin Sallings dustin at spy.net
Fri Sep 21 17:01:29 UTC 2007


On Sep 21, 2007, at 2:25 , K J wrote:

> What I meant was, suppose I have a Memached list of 1000 IDs. Now I  
> want to search that list to see if ID 234 is in that list or not.   
> My program logic would have to iterate through that entire list  
> correct?  Whereas MySQL would use its index to find it quickly.

	There's no such thing as a memcached list.  It's just a blob of data  
you're storing.

	It can, for example, be a sorted array of fixed-precision integers.   
That'd actually give you more compact storage (4 bytes fixed for 32- 
bit integers), *and* after you pull it out you could detect the  
presence in O(log n).

	If you're really concerned about people with lots of friends, store  
a bloom filter.

	Enough speculation, though.  Go see what's faster under heavy load.

-- 
Dustin Sallings


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.danga.com/pipermail/memcached/attachments/20070921/1b0ee3a7/attachment.htm


More information about the memcached mailing list