On Thu, Jun 16, 2016 at 9:40 PM, Drago, William @ CSG - NARDA-MITEQ <
william.dr...@l-3com.com> wrote:

> > On Behalf Of James K. Lowden
> >
> >       create view vParts as
> >       select 1 as Matched, * from Parts
> >       UNION
> >       select 0, * from UnmatchedParts
>

Why UNION instead of UNION ALL here?
Thanks to the 1 and 0, there can't be any dups, so the dedup step of UNION
wastes cycles, no?


> This helps a lot. Thank you. I would have never thought of this on my own.
> I tried it, it works, and I like it.
>

Do try/compare your queries with the original table, and this new view
fetching from two tables.

The query optimizer might not "see" through to view well enough to get
plans as good as on the single table. --DD
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to