简体   繁体   English

SQL 服务器 - 远程 Oracle 查询在日期子句上非常慢

[英]SQL Server - remote Oracle query extremely slow on date clause

Querying oracle from sql server client:从sql服务端客户端查询oracle:

select top 10 * from [192.168.18.25]..ORDER where date >= '2019/01/01'

The above query takes about 400 seconds , while in oracle client it takes only milliseconds.上面的查询大约需要400 秒,而在 oracle 客户端中只需要几毫秒。

What surprises me more is that when replace the >= with <= , or replace the date 2019/01/01 to a date that is less than the minimum date in the table, the query will again finish in milliseconds.更令我惊讶的是,当将>=替换为<=或将日期2019/01/01替换为小于表中最小日期的日期时,查询将再次以毫秒为单位完成。

What may have caused the poor performance on >= someDate in the query?什么可能导致查询中>= someDate的性能不佳?

Somehow I tried OPENQUERY and the performance problem is solved:不知何故,我尝试了OPENQUERY并解决了性能问题:

select top 10 * from openquery ( [192.168.18.25], 
'select * from order where date >= ''2019-01-01'' ')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM