Results 1 to 5 of 5

Thread: Database/ADO.NET people...

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618

    Database/ADO.NET people...

    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?
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  2. #2
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632
    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:
    Code:
    SELECT *
    FROM Jobs
    WHERE UserID IN (4,6,18)
    Or I could do 3 small ones...
    Code:
    SELECT *
    FROM Jobs
    WHERE UserID = 4
    'then
    SELECT *
    FROM Jobs
    WHERE UserID = 6
    'then 
    SELECT *
    FROM Jobs
    WHERE UserID = 18
    If that what you mean?
    The 1st option is the fastest.

    Woof

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618
    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
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  4. #4

  5. #5
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    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
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width