Quantcast
Channel: Forum Getting started with SQL Server
Viewing all articles
Browse latest Browse all 7129

How to modify on to be sargable- sql

$
0
0

I have the following query

update rset Comp = t.Compfrom[QlikDataWarehouse].[dbo].[Vente]rinnerjoin[QlikDataWarehouse].[dbo].[Budget] ton t.[Code Site]= r.[Code Site]and
        t.[Code Rayon]= substring(r.[Code Structure],1,4)and
        t.[Date Time]=convert(date,r.[Date Time])where r.[Date Time]>='2015-01-01 00:0:00.000';

nmber of rows of budget is around 800000 and vente around 350+millions rows . I create index vente([Date Time], [Code Site], [Code Structure]) and Budget([Code Site], [Code Rayon], Date Time]). But the query took days running .

t.[Code Rayon] is an int type t.[Date Time] is a date type r.[Date Time] is datetime type Is there a way to make clause On sargable ?

Any help would be the most appreciated.


Viewing all articles
Browse latest Browse all 7129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>