Hello, please, is there any way to make SQLite use an index on two columns when I want to select all rows which have some combination of the two columns?

My table is:
CREATE TABLE PointFeature (
DSetId INTEGER,
SectId INTEGER,
PntItemId INTEGER);

CREATE INDEX xxx ON PointFeature (DSetId, SectId, PntItemId);

and the query is
SELECT * FROM PointFeature WHERE
DsetId=203 AND SectId IN (4,400);

But the index is used just to find the DsetId and not to find SectId.
Is there another form of the SQL which could do that? Or do I have to use two separate queries

SELECT * FROM PointFeature WHERE
DsetId=203 AND SectId=4;

SELECT * FROM PointFeature WHERE
DsetId=203 AND SectId=400;

Thank you very much,
Jakub

SELECT DsetId, SectId, pntitemid FROM add.point_features WHERE 1 AND DsetId=203 AND SectId IN (4,435)
addr    opcode  p1      p2      p3      
0       Goto    0       49              
1       Integer 2       0               
2       OpenRead        1       66      keyinfo(3,BINARY,BINARY)        
3       KeyAsData       1       1               
4       SetNumColumns   1       4               
5       Integer 203     0               
6       NotNull -1      9               
7       Pop     1       0               
8       Goto    0       47              
9       MakeRecord      1       0       iii     
10      MemStore        0       0               
11      MoveGe  1       47              
12      MemLoad 0       0               
13      IdxGE   1       47      +       
14      RowKey  1       0               
15      IdxIsNull       1       46              
16      Integer 1       0               
17      IfNot   1       46              
18      MemLoad 1       0               
19      If      0       32              
20      Integer 1       0               
21      MemStore        1       1               
22      OpenTemp        2       0       keyinfo(1,BINARY)       
23      SetNumColumns   2       1               
24      Integer 4       0               
25      MakeRecord      1       0       i       
26      String8 0       0               
27      PutStrKey       2       0               
28      Integer 435     0               
29      MakeRecord      1       0       i       
30      String8 0       0               
31      PutStrKey       2       0               
32      Integer 1       0               
33      Column  1       1               
34      NotNull -1      38              
35      Pop     2       0               
36      String8 0       0               
37      Goto    0       41              
38      MakeRecord      1       0       i       
39      Found   2       41              
40      AddImm  -1      0               
41      IfNot   1       46              
42      Column  1       0               
43      Column  1       1               
44      Column  1       2               
45      Callback        3       0               
46      Next    1       12              
47      Close   1       0               
48      Halt    0       0               
49      Transaction     2       0               
50      VerifyCookie    2       79              
51      Goto    0       1               
52      Noop    0       0               

Reply via email to