I have created the following simple view:
CREATE VIEW cs.MyTestPO AS
SELECT ttdpur401100.t_orno
, ttdpur401100.t_item
, ttcibd001100.t_dsca
FROM ttdpur401100
JOIN ttcibd001100 ON ttcibd001100.t_item = ttdpur401100.t_item
Then SELECT * FROM cs.MyTestPO
returns 276376 rows
If I run the select statement by itself
SELECT ttdpur401100.t_orno
, ttdpur401100.t_item
, ttcibd001100.t_dsca
FROM ttdpur401100
JOIN ttcibd001100 ON ttcibd001100.t_item = ttdpur401100.t_item
it returns 277488 rows
Can anyone suggest why the view is missing 1112 rows that the SELECT statement returns.
If there is truly a difference between selecting from a view and running its definition ad-hoc, I would:
It would be interesting to see if there's a difference in execution plans, statistics io, etc. before doing any of this, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With