简体   繁体   中英

SQL Server - remote Oracle query extremely slow on date clause

Querying oracle from sql server client:

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.

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.

What may have caused the poor performance on >= someDate in the query?

Somehow I tried OPENQUERY and the performance problem is solved:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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