SQL server 2005 Query with Joins


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: SQL server 2005 Query with Joins

  1. #1
    Join Date
    Feb 2007
    Posts
    11

    SQL server 2005 Query with Joins

    I have a query with multiple inner joins and left joins (about 40). When I run the query it takes about 20 seconds to return 3000 records.

    When I get the records without the joins it takes 1 second. When I run the query with all the joins but returning columns from the main table only it also takes 1 second.

    How can I improve the query? Any tricks with joins? or is this a performance cost I have to pay for using joins?

  2. #2
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,666
    When you get the records without the joins do you get only those records that you want?

    When you get the records with all the joins but returning columns from the main table do you get only those records that you want?

    If the answer to either is yes, then you don't need the joins.
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

  3. #3
    Join Date
    Feb 2007
    Posts
    11
    When I get the records from the main table (without the joins) I am getting the ID records while I need to get the NAME records (and for that I'm using the joins).

Similar Threads

  1. Installing Biztalk Server 2006
    By imranx101 in forum .NET
    Replies: 10
    Last Post: 06-13-2008, 11:32 AM
  2. SQL CE -> SQL Server 2005 Bitmap transfer
    By roundy72 in forum Mobile
    Replies: 1
    Last Post: 03-05-2008, 07:36 AM
  3. Replies: 0
    Last Post: 12-20-2006, 08:50 AM
  4. SQL Connectivity with Linked MS Access DB
    By David Croft in forum Database
    Replies: 0
    Last Post: 08-13-2003, 12:45 PM
  5. Return Query Estimate for SQL Server 2000
    By Daniel Reber in forum Database
    Replies: 0
    Last Post: 09-13-2002, 08:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center