In general for using ADO.NET to pull data out of a database, is doing one big join have better performance than a few simpler selects?
Printable View
In general for using ADO.NET to pull data out of a database, is doing one big join have better performance than a few simpler selects?
That doesn't make any sense, and I don't think it has anything to do with .NET. It more about DB executions.
Anyways, I don't understand?
How can u do one BIG select or lots of small ones?
Say I wanted to load jobs for 3 users with ID's 4,6 and 18, I could do:
Or I could do 3 small ones...Code:SELECT *
FROM Jobs
WHERE UserID IN (4,6,18)
If that what you mean?Code:SELECT *
FROM Jobs
WHERE UserID = 4
'then
SELECT *
FROM Jobs
WHERE UserID = 6
'then
SELECT *
FROM Jobs
WHERE UserID = 18
The 1st option is the fastest.
Woof
I meant using joins.
Select Table1.Col1, Table1.Col2, Table2.Col1 FROM Table1, Table2 WHERE Table1.Key = Table2.Key
How much (is it) more efficient than to do:
Select Key, Col1, Col2 From Table1
Select Col1 From Table2 Where Key = Key1
Hmmmm...the 1st one, definately.
It's faster, uses less resources and it's easier to deal with the data.
Woof
I think it depends on the number of tables and the types of joins too..... Sometimes an inner select with a join on the outter works best. But it really depends on what you are trying to accomplish. For two or three simple tables, a single query with joins should be sufficient. But I've done stuff with 7 or 8 tables where it was more efficient to join to inner selects.
TG