I have a hideous query that looks like this:

SELECT anf.name AS child, anf2.name||anf3.name||anf4.name AS parent
[...]
WHERE child='albuquerque' AND parent='newmexico';

which takes forever to run. However, when I replace 'child' with
'anf.name' in the WHERE clause, it runs lightning fast (as expected,
since I have tons of indexes).

Even more bizarrely, when I create a view:

CREATE VIEW childparent AS
SELECT anf.name AS child, anf2.name||anf3.name||anf4.name AS parent
[...]

and then do:

SELECT * FROM childparent WHERE child='albuquerque' AND parent='newmexico';

it's again very fast.

Is this expected behavior?

-- 
We're just a Bunch Of Regular Guys, a collective group that's trying
to understand and assimilate technology. We feel that resistance to
new ideas and technology is unwise and ultimately futile.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to