SQLite Forum

SQLite doesn't use indexes for bitwise clauses?
Login
Bitwise evaluation of the index value?

Functionally we only use bitwise operators when we use a column as a bitfield, and trying to do equivalent non-bitwise operations doesn't make much sense to me.


```
IF (x & 0x0040 != 0)
```

is equivalent to what without bitwise operators?

SQLite knows I specified a bitwise operator in the expression so the hope/expectation is it could do...something.

In theory I could specify some kind of hint e.g. *column == use bitwise index evaluation

```
SELECT * FROM table WHERE *x & ? != 0;
```

I could even live with a hint in the schema definition to indicate it supports bitwise operations (`CREATE TABLE..N INTEGER NOT NULL HINT BITFIELD...` or something in CREATE INDEX?). I'd rather see SQLite automagically handle it but the perf benefits should be significant enough I can justify additional markup on my part if necessary

There's always the new-type option (BITFIELD instead of INTEGER) but I expect you're even less of a fan than I am (and I'm not :P)