Jump to content

Not indexing all table rows?


zq29

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
https://forums.phpfreaks.com/topic/54726-not-indexing-all-table-rows/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.