Hello,

i'm quite new to programmind with databases...
I'll try to explain my Problem on a symplified example:
I have Two Tables with large amount of data:
CREATE TABLE "tabelle1" (
    "id" INTEGER PRIMARY KEY AUTOINCREMENT,
    "wert" INTEGER
)

CREATE TABLE "tabelle2" (
    "id" INTEGER PRIMARY KEY AUTOINCREMENT,
    "wert" INTEGER
)

Both tables have an index:

CREATE INDEX "index1" on tabelle1 (wert ASC)
CREATE INDEX "index2" on tabelle2 (wert ASC)

Then I have a View using these two tables definde like this (PSEUDEOCODE):

SELECT [...] FROM  tabelle1 
   UNION   
SELECT  [...] FROM  tabelle2

When I do a Select on the tables (SELECT * FROM tabelle1) the Index is used,
but when I do a Select on the View (SELECT * FROM myView) , the Index is NOT
used,
so the select takes too much time.

I figured out, that the Problem is the UNION (if I remove the second select,
it seems to work).
So what can I do???

Thank you,

McZerberus






-- 
View this message in context: 
http://www.nabble.com/Indexing-on-UNION-tp20501321p20501321.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to