结果集比较实用程序 [英] Resultset comparison utilities

查看:61
本文介绍了结果集比较实用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么好的工具可以比较2个查询的结果集并突出显示差异。当重新编写查询以进行性能调整时,这特别有用,我们希望确保查询产生相同的结果。我当时使用Quest SQL优化程序比较原始查询和重写查询,但是该工具仅在计算行数时停止,某种形式的实际数据比较应该非常有用。

Is there any good tool which can compare the resultset for 2 queries and highlight the difference. This could be particularly useful when the queries are re-written for performance tuning and we want to be sure that the query produces same result. I was using Quest SQL optimizer to compare original and re-written queries but the tool stops at just counting the number of rows, some form of actual data comparison should be very helpful.

推荐答案

如果查询Q1和查询Q2返回相同的行数,则该查询将检查它们返回的数据完全相同:

If query Q1 and query Q2 return the same number of rows this query will check that they return exactly the same data:

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

也就是说,结果应与独立运行时每个查询返回的行数相同。

That is, the outcome should be the same number as the number of rows returned by each query when run standalone.

这篇关于结果集比较实用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆