Howard Kapustein wrote: > I'm setting SQLite logging a warning > Warning 0x11C: automatic index on PackageIdByAll(_PackageID) > > WITH ... > PackageIdByAll(_PackageID) AS (...) > SELECT * > FROM ... > INNER JOIN PackageIdByAll AS cte_p ON cte_p._PackageID=pkg._PackageID > > Why? > > PackageIdByAll is a CTE. I can't CREATE INDEX for it.
The warning tells you that the database created an automatic index. This does not imply that you _must_ create an index, it's just a hint that you should think about whether it is possible to improve the query. If you have a table, creating the index explicitly is the easiest way, but for CTEs/views/subqueries, you might have to change the query itself, or the database schema, or determine that the automatic index is the best choice in your situation. > _PackageID is the primary key of the Package table > So indexing should be covered being the table's ROWID. When you use the rowid to look up a table row, you still don't know which CTE row that would correspond to. Regards, Clemens _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users