You are here: Re: Actual and Estimated Rows « MsSQL Server « IT news, forums, messages
Re: Actual and Estimated Rows

Posted by Robert Klemme on 11/28/17 11:58

cbrichards via SQLMonster.com wrote:
> So perhaps a little more information will be helpful.
>
> First of all, this is the query statement that generates the differing actual
> versus estimated rows:
>
> (The variables are of type int, sent as arguments to the stored procedure.)
>
> SELECT y.rpFID, x.dCode, x.Desc, x.dcUID
> FROM dbo.Table_X x
> JOIN dbo.Table_Y y
> ON x.dcUID = y.dcFID
> AND x.MainID = y.MainID
> JOIN dbo.Table_Z z
> ON y.rpFID = z.rpUID
> AND y.MainID = z.MainID
> WHERE z.pFID = @pID
> AND z.MainID = @MainID
> AND x.MainID = @MainID
> AND y.MainID = @MainID

Something likely unrelated to your issue (Erland answered that one
already) as it does not change the semantics of your statement but I
though I mention it nevertheless: it seems two of the last lines of this
SQL statement are pretty superfluous as all three tables are joined on
MainID anyway. So I'd leave only "AND x.MainID = @MainID" in there
because Table_X seems to be your major table.

Ah, and another remark: I find these table and column names highly
unspecific. Changing them to something more meaningful (identifiers are
not restricted to 8 characters) will probably help maintain the
application.

Kind regards

robert

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация