Jump to content

Not indexing all table rows?


Recommended Posts

I have a table that contains 1,679,537 rows (UK postcodes) which also has a field that holds a float value of the distance of each postcode from another specific postcode. I am trying to index this distance field to help speed up searches, after indexing this field it's count is only 279,922 indexes.


I'm not 100% sure how indexing works internally, does it only index distinct values? If so, there are 280,801 distinct distances so that doesn't quite add up.


Before indexing, my queries return rows, but after indexing I'm getting nothing returned. Am I using indexing properly?


Here's one of my queries, the only thing that changes is the distance range.

SELECT COUNT(*) FROM `club` AS c, `postcodes` AS p WHERE c.`postcode` = p.`postcode` AND p.`dist` BETWEEN '0' AND '5'

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.