Hi Group,
how does Informix execute a WHERE statement in a query on a VIEW? Suppose we have this view (syntax might be not 100% accurate)
CREATE VIEW myview AS
SELECT st.blah AS st_blah,
st.whatever AS st_whatever,
st.anotherthing AS st_anotherthing,
at.thingy AS at_thingy,
at.growl AS at_growl
FROM some_table st
LEFT JOIN another_table at ON st.blah = at.thingy
ORDER BY st.blah;
which is cheaper: add the WHERE in the VIEW, or in the query on the VIEW? So, which one is cheaper:
CREATE VIEW myview AS
SELECT st.blah AS st_blah,
st.whatever AS st_whatever,
st.anotherthing AS st_anotherthing,
at.thingy AS at_thingy,
at.growl AS at_growl
FROM some_table st
LEFT JOIN another_table at ON st.blah = at.thingy
WHERE st.blah = 1
ORDER BY st.blah;
or, a WHERE query on the first VIEW example:
SELECT * FROM myview WHERE st_blah = 1;
Or will the eventual query plan be the same and thus similar performance?
Thanks in advance,
Arjen.
------------------------------
Arjen Van Drie
------------------------------
#Informix