OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: A question about index

From: Moon's Father (yueliangdao0608gmail.com)
Date: Wed May 21 2008 - 02:07:09 CDT


Thanks very much.

2008/5/21 Paul McCullagh <paul.mccullaghprimebase.com>:

>
> On May 21, 2008, at 8:46 AM, Paul McCullagh wrote:
>
> On May 21, 2008, at 8:09 AM, Moon's Father wrote:
>>
>> Now I want to know which way you use to create index of a table.
>>> 1$B!"(Bix_u (item_id,item_count)
>>> ix_item_count (item_count)
>>>
>>
>> This makes sense if you have queries which search "item_id AND
>> item_count", and queries which just search the column 'item_count'.
>>
>
> On second thoughts, this answer is not complete.
>
> If this is case then the index ix_u (item_count, item_id) would be the best
> choice.
>
> These indices:
>
> ix_u (item_id,item_count)
> ix_item_count (item_count)
>
> are best when you have the following types of queries:
>
> WHERE item_id AND item_count ----> the server uses ix_u
> (item_id,item_count)
> WHERE item_id ----> the server uses ix_u
> (item_id,item_count)
> WHERE item_count ----> the server uses x_item_count
> (item_count)
>
>
>
>>
>> 2$B!"(Bix_u (item_id,item_count)
>>> ix_item_id (item_id)
>>>
>>
>> This is duplication of the indexing of the column 'item_id'. The server is
>> able to use the index ix_u (item_id,item_count) to search on the column
>> 'item_id'.
>>
>
>

--
I'm a mysql DBA in china.
More about me just visit here:
http://yueliangdao0608.cublog.cn