I want to optimize a query1 of the form
SELECT yid, xid FROM x WHERE is_principal;
Here, is_principal
is a non-null boolean column of x
.
If I run EXPLAIN QUERY PLAN
on this query, the output I get is
0|0|0|SCAN TABLE x
I'd like to turn this SCAN
into a SEARCH
, so created the following index:
CREATE INDEX x_is_principal_idx ON x (is_principal);
...but it made no difference: the output of EXPLAIN QUERY PLAN
remains unchanged.
Is there some other way to optimize this query?
1 FWIW, this query is in fact a sub-query of a much larger query that I'm trying to optimize.
Aucun commentaire:
Enregistrer un commentaire