Page 1 of 1

Better index possible

PostPosted: Wed May 16, 2007 5:04 pm
by penguin

I have just downloaded the database dump and played a bit around. It looks pretty exciting! However, as far as I can see for each table there are two separate indexes for the fields b and c.

MySQL 4 can only use one index per table. For a fully populated table that would still require a scan over 256 records after the index has been used. MySQL 5 can optimize this and do an index_merge however, but it still requires a lookup in both indexes.

A better generic approach would be to have the index span both fields:
Code: Select all
KEY `kb` (`b`, `c`)

I hope you would consider this change in the future.

Furthermore I find the split of the IP address into several cells somewhat artificial as IPs are nothing but just 32 bit integers. But that's an entirely different story :-)