Information générale
Forum:
Microsoft SQL Server
Catégorie:
Conception bases de données
>>>Sorry for so many questions this morning. I found a "bottleneck" in my app (not super critical but I need to find a way to deal with it).
>>>
>>>If I am to add a column that will have two values, False and True, and build an index on this column, would the column type BIT be the best? In terms of including this column in the WHERE clause? Logically, I think, Bit would be the best, 0 and 1. But there could be a case of making this column Char(1) and storing '0' or '1'.
>>>Which one would give me better performance (speed) in SQL Select?
>>
>>For logical values, I always use Bit. I have found this to work very well with indexing.
>
>Thank you.
AFAIK using non-nullable Bit is the best way to hint to SQL to use an optimization similar to INDEX ... BINARY of vfp.
Still I doubt the effect will be as marked as of using a binary index in vfp across LAN/WAN, as SQL has better access to saved physical data.
Indeces with low selectivity/cardinality are suspect, probably ONLY helpful if selecting/filtering minuscle subset of all records, eliminating table scan of majority which will be discarded.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement