Re: Best practices for using MySQL index
| From: | Shelley | Date: | Thu, 01 May 2008 06:31:59 +0000 |
| Subject: | Re: Best practices for using MySQL index | ||
| References: | 1 2 3 4 | Groups: | php.db php.general |
| Request: | Send a blank email to php-db+get-44945@lists.php.net to get a copy of this message | ||
On Wed, Apr 30, 2008 at 7:03 PM, Aschwin Wesselius <aschwin@illuminated.nl>
wrote:
> Shelley wrote:
>
> Don't index just all integer fields. Keep track of the cardinality of a
> column. If you expect a field to have 100.000 records, but with only 500
> distinct values it has no use to put an index on that column. A full record
> search is quicker.
>
>
> Hmmm... That's new. :)
>
>
>
> Well, to give you a good measure: keep the cardinality between 30 to 70-80
> percent of your total records in a column. But sometimes your field is NULL
> or empty, so it really depends. You can't just put it into a standard
> configuration. And it also really depends on how many records a table
> contains etc.
>
> Besides that, benchmarking your development environment (you do have one
> do you?) can gives you a good idea on how your hardware and setup performs.
>
I think I missed that part. For I am concerning query, index, and entity
design most of the time.
>
>
> Aschwin Wesselius
>
--
Regards,
Shelley