all groups > sql server (alternate) > november 2005 >
You're in the

sql server (alternate)

group:

SQL View Performance


Re: SQL View Performance Serge Rielau
11/23/2005 10:42:04 PM
sql server (alternate): [quoted text, click to view]
You want UNION ALL

Cheers
Serge

--
Serge Rielau
DB2 SQL Compiler Development
SQL View Performance Auday Alwash
11/24/2005 12:00:00 AM
Hi all,

SQL Server 2000 service pack 3 running on Quad zeon windows 2003 server
with 6GB of ram.

A few months ago we split our databases into operational and completed
data...

So now instead of doing select * from tblTest, we do select * from
tblTestboth where tblTestboth is a view like this:

Select *
From Operational.dbo.tbltest
UNION
Select *
From Archive.dbo.tbltest

The tables on both databases are heavily indexed but it still takes much
longer to do the select * from tblTestBoth than it is to do

Select *
From Operational.dbo.tbltest
UNION
Select *
From Archive.dbo.tbltest

Can anyone please tell me why that is? We are starting to get timeouts
regularly...

Should I use indexed views even though the data is inserted/updated
multiple hundres of times per second?

Thank you very much in advance for your help...

Regards,

Auday

Re: SQL View Performance Madhivanan
11/24/2005 6:12:26 AM
UNION ALL is more efficient that UNION as UNION will unnecessarily
select Distinct and Order the data

Madhivanan
Re: SQL View Performance Danny
11/25/2005 12:34:08 PM
You also will want to change the view to an partitioned view. Is will allow
queries against the constraint to only run against the table it needs and
not both.


[quoted text, click to view]

AddThis Social Bookmark Button