Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 5123

Columnstore - Optimization Question

$
0
0

Hello,

 I am trying to query a columnstore table and it looks like the query optimizer - as part of optimzation - is trying to scan all the rows first and then apply the filter. Unfortunately,  this is causing the code to fail.

I understand how to fix it  but I am more interested in knowing if this is how it is supposed to behave on columnstore table.

below is sample script.  you need to insert large no of rows, for it process in batch mode.

Create Table Test(snot int,sname varchar(20))
go
declare @a int =1
While (@a<3000000)
Begin
Insert into Test(snot,sname)
Select @a,'Victor,Jordan'+Cast(@a as varchar)

set @a=@a+1
End

update Test set Sname=replace(sname,',','') where snot between 1000 and 2000

create clustered Columnstore Index  CCI_Test on TEST

select Snot, Left(Sname,Charindex(',',SName)-1) from Test where Charindex(',',SName)>1 AND sName like 'V%'


Hope it Helps!!


Viewing all articles
Browse latest Browse all 5123

Trending Articles



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