Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / General / Data Warehousing / October 2004

Tip: Looking for answers? Try searching our database.

again and again... query analyzer and wrong SQL statement plan... + outer join?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
J?j? - 19 Oct 2004 21:51 GMT
Hi,

again we have some SQL statement performance problems...

I've 2 table with 140 000 records each.
I join the 2 tables and the result is also 140 000, but the query analyzer
estimate 1000 rows only.

Its a simple join with 5 equals in the join
select * from tableA inner join table B on A.ID1 = B.ID2......

all the stats for my tables are ok.

its not a so big problem, but when I want to estimate before an execution
and when the result is far different, its a big surprise for me!

Also, we have aproblem with a query which use 1 inner join and 3 left outer
join.

Each outer join is a sub-query which contain a group by:
select *from A inner join B on A.ID = B.ID
left outer join (Select ID1, ID2 from C group by ID1, ID2) CC
on A.ID1 = CC.ID1 and A.ID2 = CC.ID2
...
(the 2 others outer join use the same syntax)

This query takes more then 10 minutes, but if I precalculate each sub-query
in a temporary table and if I use these tables instead-of the sub-queries,
the result appear in only 19seconds!!!!!

how can I tell SQL Server to use the same way without creating myself the
temporary tables?
there is any table hint option to force SQL Server to treat the sub queries
has "physical tables".

I know its not the first time you have this type of questions... so thanks
for your time (again)

Jerome.
Melih SARICA - 20 Oct 2004 08:07 GMT
create an Index for those 5 columns on each table.. But only those 5 columns
ll be used..

And let SQL estimate the proper Index for the execution

> Hi,
>
[quoted text clipped - 35 lines]
>
> Jerome.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.