> 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?

> SELECT * FROM PointFeature WHERE
> DsetId=203 AND SectId IN (4,400);

I can't answer the question you asked, but I will point out one thing.  Many 
SQL engines attempt to optimize index use in queries.

For instance, in MS SQL Server, your query might *not* use the second column in 
the index if using the index would take perform more
poorly than not using it.  Using an index is not always faster than doing a 
table scan.  If there are only a few rows where DsetId
is equal to 203, the table scan of that subset could very well be faster than 
using an index to look up the values.

In our MS SQL Server environment, we usually don't even bother to create 
indexes on more than one field if there are going to be
less than a few hundred rows in a subset of a query like that.  It takes the 
server longer to do the index lookup than it would the
table scan.

Reply via email to