Results Comparison Utilities

Is there a good tool that can compare a set of results for 2 queries and highlight the difference. This can be especially useful when requests are being rewritten to tune performance, and we want to be sure that the request gives the same result. I used the Quest SQL optimizer to compare source and rewritten queries, but the tool stops when counting the number of rows, so some form of actual data comparison should be very useful.

+2
source share
1 answer

If query Q1 and query Q2 return the same number of rows, this query will verify that they are returning exactly the same data:

select count(*) from 
    ( select * from q1
      intersect
      select * from q2 )
/

, , .

+3

All Articles