Groups | Blog | Home
all groups > sql server replication > july 2006 >

sql server replication : Query Optimisation


Eckhart
7/29/2006 12:45:34 AM
DearAll,
I applied the modifications by implimenting the joins,created indexes
on relevent columns which are acting as optimizer hints-result positve
improvement in the query processing,apart from that there is one more
issue thats supposed to be considered for code reusablity,
Eg: When on more service name comes into picture then the following
code(part of procedure) is supposed to modified [Eg new service name
QTEL]
select case servicename
when 'AKTEL' then 'Aktel'
when 'QATAR2900' then 'STAR MULTIMEDIA 2900'
when 'TELEMOVIL' then 'TeleMovil'
when 'COMCEL' THEN 'COMCEL'
when 'TSTTNEWS' then 'TSTT'
when 'TSTTWAP' then 'TSTT'
when 'TSTT_MMS' then 'TSTT MMS'
when 'ALCLICKWIN6464' then 'Airtel Click Win 646'
when 'ALMMSPORTAL' then 'Airtel MMS'
when 'ALMMSSMSDWN' then 'Airtel MMS SMS'
when 'ALMYALBUM646' then 'Airtel My Album'
when 'HINDU6397' then 'Hindu 6397'
So in such a situation can i go for a cursor instead of Select Case,I
fear cursor a lot 'cos of their severe appetite for memory- & slowing
down the dataprocessing & database server activity.
Also is it wise enough to use insert dml with a select to load the
data of size greater than 100000 recs ? Can i use some thing like bcp
Regards
Eckhart
Paul Ibison
7/31/2006 12:00:00 AM
If it needs to be dynamic in the sense that the case statement will need
altering, I'd get rid of it and add all the pairs of values to a lookup
table. The main query will simply do a join onto the table to convert the
values. New values can easily be added to the lookup table without requiring
the code to change, and indexes can be used on the lookup table as well.
Cheers,
Paul Ibison SQL Server MVP, www.replicationanswers.com

AddThis Social Bookmark Button