Subject | Re: index selectivity |
---|---|
Author | Sergio |
Post date | 2010-11-08T12:50Z |
--- "Leyne, Sean" wrote:
Thanks for the answer Sean! Probably the fact that I don't speak english very well is not helping me here... I don't have quite clear wheter it is a good idea to use the index or not...
My paricular case is a calendar with events in some days. I need to select the pending events. They will be always, lets say, less than 100, while the table, as the the years pass will grow a lot with the old (not pending) events...
So, in my case, makes sense to have an index on the "pending" field (which is smallint and can store 0 or 1)
Sorry fo insist with the question!!! and thanks again for your help!!
-sergio
> Yes, unless you can combine the Boolean field with another filed which is used very commonly is your SELECTs.--------------
>
> Otherwise, you should not index a low selectivity field (boolean) the cost* of the index is not worth it.
>
>
> Sean
>
> *Cost includes several factors,, including the extra I/O operations required to maintain the index as well as the fact that the engine might want to include the field/index into a SELECT which would result in a slower performing statement.
Thanks for the answer Sean! Probably the fact that I don't speak english very well is not helping me here... I don't have quite clear wheter it is a good idea to use the index or not...
My paricular case is a calendar with events in some days. I need to select the pending events. They will be always, lets say, less than 100, while the table, as the the years pass will grow a lot with the old (not pending) events...
So, in my case, makes sense to have an index on the "pending" field (which is smallint and can store 0 or 1)
Sorry fo insist with the question!!! and thanks again for your help!!
-sergio