In a (rather complex) T-SQL statement I used the expression:
WHERE .... AND fieldx = 1 ....
fieldx has datatype 'bit'.
The query performed very poor, and removing this specific constraint speeded things up more then 10 times.
Because I needed the constraint anyways, I made a wild experiment: I changed the datatype to int, and put an index on it. Guess what: performance still 10 times better then before.
Not being an SQL-guru at all: what is happening here? I'd think a bit-field would me much faster then an indexed int-field?
WHERE .... AND fieldx = 1 ....
fieldx has datatype 'bit'.
The query performed very poor, and removing this specific constraint speeded things up more then 10 times.
Because I needed the constraint anyways, I made a wild experiment: I changed the datatype to int, and put an index on it. Guess what: performance still 10 times better then before.
Not being an SQL-guru at all: what is happening here? I'd think a bit-field would me much faster then an indexed int-field?