Namespaces

David Phillips electrum at gmail.com
Thu Jun 23 10:07:22 PDT 2005


On 6/23/05, Eamon Daly <edaly at nextwavemedia.com> wrote:
> I have 100 tables, each containing 20,000
> rows, with zipcode as the PK. When a zipcode comes in, our
> application checks each table and reports which tables
> contain that zipcode.

If you only have 2,000,000 rows, why not store them all in the same
table?  It should be a lot faster than checking one hundred tables
each time.  It sounds like you could do something like this:

SELECT data FROM zips WHERE zipcode = '$zip' ORDER BY version DESC LIMIT 1;

If your average record size is less than about 1k, you could cache the
entire thing in memory.

-- 
David Phillips <david at acz.org>
http://david.acz.org/


More information about the memcached mailing list