Better index possible

Development discussion about the hostip.info codebase, libraries, and database

Moderator: Moderators

Better index possible

Postby penguin on Wed May 16, 2007 5:04 pm

Hi,

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 :-)
- Peter Brodersen
penguin
n00b
 
Posts: 1
Joined: Wed May 16, 2007 4:55 pm

Return to Hostip.info code/database devel

Who is online

Users browsing this forum: No registered users and 1 guest

cron