March 13, 2008 at 5:07 am
Hi all,
I have two tables tableA and tableB.tableA is the parent of tableB.The primary key of tableA is id and tableB is id.The foriegn key is bid.now i have a query like this
select a.name from tableA where exists(select b.bid from tableB where b.bid=a.id) .this is a joined query.when i run this in Toad the explain plan shows as
cost:7;cardinality is 1:bytes:27
The above query can be written as
select a.name from tableA a,tableB b where a.id=b.bid;when i run this in Toad the expalin plan shows
cost:7;cardinality:33;bytes:134
Can anyone explain to me wat cardinality means.
Thanks,
Kiran
March 13, 2008 at 5:39 am
Kiran
You should read the topic "Cardinality estimation" in Books Online. If there's anything you don't understand, or if it doesn't cover everything you need to know, please post again. By the way, you should look at using ANSI syntax for your join queries: it is clearer to read, and the non-ANSI syntax may not be valid in future versions of SQL Server.
John
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply