Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Improve performances

Author  Topic 

khalik
Constraint Violating Yak Guru

443 Posts

Posted - 2009-03-30 : 08:02:44
Hi guys

I have a performance issue here. i have to run a query with 80 column in select list and this hit 3 tables which have very huge data.

i have 3 such blocks of query. so i am using union all. the end result is very slow.
i have used database engine tuning advisor and tuned individual single qry still not much improvement.

what would be the suggestions. any better way to improve the performance

Thanks in advance..

========================================
Project Manager who loves to code.
===============
Ask to your self before u ask someone

darkdusky
Aged Yak Warrior

591 Posts

Posted - 2009-03-30 : 09:23:04
We need more details - e.g table definitions, query being used, how many rows are returned - what is total time and what is the individual time for each UNION block?
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

khalik
Constraint Violating Yak Guru

443 Posts

Posted - 2009-03-30 : 10:14:04
Thanks ,

As i said i have hude table (no of columns & data) giving the table structure will not be possible and also i cannot not put up the actual structure.

its a simple query using Inner Join with a where clause.. what, i was trying to understand is huge tables (structure & data )using union all is good?

i have million + rows all put together. business wise i have transaction info in 3 heads open , close, acrh all same table structure

so query will be like this

select a.* from openA A inner join OpenB B on a.id=b.id inner join OpenC C on b.id=c.id where loc='Axd' and Branch='xxx'
union all
select a.* from CloseA A inner join CloseB B on a.id=b.id inner join CloseC C on b.id=c.id where loc='Axd' and Branch='xxx'
union all
select a.* from AcrA A inner join AcrB B on a.id=b.id inner join AcrC C on b.id=c.id where loc='Axd' and Branch='xxx'

or any other better way to do it.

========================================
Project Manager who loves to code.
===============
Ask to your self before u ask someone
Go to Top of Page
   

- Advertisement -