Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Native query on Oracle use TO_TIMESTAMP function for date fields

community.powerbi.com/t5/Power-Query/Native-query-on-Oracle-use-TO-TIMESTAMP-function-for-date-fields/m-p/1938663

 

 

In Power Query for Oracle DB queries involving fields with the DATE type all filtering through query-folding is using the TO_TIMESTAMP function. As incremental refresh is implemented, we cannot use SQL statement option.

 

This causes issue as Oracle invokes internal function on date field used in filter to match timestamp. This is problematic as for large tables the quesry goes for full table scan instead of using index created on date field. This results in performance issues and the refresh failures invloving fact tables with huge data.

 

 

VishalSukhija_0-1625513937118.png

 

 

 

 

Index is consider if TO_TIMESTAMP is replaced with TO_DATE function

 

VishalSukhija_1-1625513937715.png

 

 

Is there a way to avoid TO_TIMESTAMP function being called here?

 

Thanks,

Vishal

Status: New
Comments
v-robertq-msft
Community Support

Hi,

Have you tried the TO_DATE function and use the index to improve the speed?

You can go to the Oracle community to ask for the suggestions of experts in Oracle.

 

Best Regards,

Community Support Team _Robert Qin

VishalSukhija
Frequent Visitor

Hi,

 

It's not about using TO_DATE in Oracle. It's Power BI using TO_TIMESTAMP function while firing sql in Oracle which I am unable to change. 

 

This happens when Incremental Refresh is implemented and we have to define two parameters RangeStart and RangeEnd, and use this to filter table on cdc date field. The native query from this step uses to_timestamp on the parameters.

I tried using custom functions on parameters to change the format to datetime, still to_timestamp is used in native query.

 

Found a post with same issue explained:

https://social.technet.microsoft.com/Forums/en-US/08146ac8-d691-4a95-b58f-a9ccc518eeae/oracle-query-...

 

Thanks,

Vishal