Contents
How to find the difference between two SQL queries?
I have tried doing the following but still no luck: Another option is writing the query with the desired where clauses. Following your description, the result of query 1 must contain the reuslt of query2. So you can use
What happens when a query does not match the result?
If any rows do not match the original query those rows will be included in the result set thus the total rows returned by the UNIONed queries will exceed the row count of the original. In this case the result sets match, so I can feel confident that the new optimized simplified query is a better solution!
How to test two sample assuming equal variances?
This can be seen from the histograms. Also, the variances are relatively similar (15.18 and 17.88) and so we can again use the t-Test: Two-Sample Assuming Equal Variances data analysis tool to test the following null hypothesis:
Which is the best way to compare two tables?
You can quickly verify the differences between two tables. You can compare the two similar tables or data sets using MINUS operator. It returns all rows in table 1 that do not exist or changed in the other table.
Why does the same query take different amount of time to run?
That can make a dramatic difference in performance if every read is coming from one of the caches rather than requiring a disk read. If you run the same query later after other work has flushed out most of the blocks your query is interested in, you may end up doing a ton of physical reads rather than being able to use the nicely warmed up cache.
Why do you get different query plans for different executions?
Are you getting different query plans for different executions (you may need to capture a query plan from your initial benchmarks and compare it to the current plan or you may need to increase your AWR retention to retain query plans for a few months in order to see this).
How to force Oracle to use the same query plan?
Depending on the version of Oracle, there are various ways to force Oracle to use the same query plan. If you can drill down and figure out what the problem with statistics is, Oracle probably provides a way to give the optimizer better statistics.