Hi,
I have a question regarding processing of sql queries in databases. I have implemented a two audit columns approach for change data capture. The result of the following views is same under experimental conditions. However, I am getting strange performance results when i extract data from the following views using cursors.
1. CREATE VIEW V_AUTHOR_UPD AS SELECT A_ID, A_FNAME, A_LNAME FROM AUTHOR WHERE (A_TIMESTAMP_UPD > CDCTS ) AND (A_TIMESTAMP_INS < CDCTS )@
vs
2. CREATE VIEW V_AUTHOR_UPD AS SELECT A_ID, A_FNAME, A_LNAME FROM AUTHOR WHERE A_TIMESTAMP_UPD > CDCTS@
Now the first query is more complex than the second one but is giving results much much faster than the second one.
The expectation was that the second query should have performed much better than the first one as it is less complex.
I have observed a similar behaviour in another scenario where a complex query is giving better results than a simple one.
Any reasonable explaination about the behaviour of sql queries?
Thanks in advance.
Faisal