Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 15th, 2004, 08:53 AM
jdower jdower is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 1 jdower User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Really basic query speed question..

Hey guys. In general, better to have 30 simple queries running to like 6 different tables, or 1 table which could return all results in one query?

Purely for speed. It doesn't matter if it's less work for me that space is duplicated. What does SQL Server run faster?
Oh yes, and the tables have about 800 rows.

Reply With Quote
  #2  
Old October 21st, 2004, 12:53 AM
Leslie's Avatar
Leslie Leslie is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Location: Honolulu
Posts: 184 Leslie User rank is Corporal (100 - 500 Reputation Level)Leslie User rank is Corporal (100 - 500 Reputation Level)Leslie User rank is Corporal (100 - 500 Reputation Level)Leslie User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 20 h 29 m 2 sec
Reputation Power: 8
If you properly index your 1 table it should not be slower than making the database chug 30 times against 6 tables. Every table has behind-the-scenes information stored in system tables. This is where SQL Server retrieves indexes and primary keys for peforming selects, for deciding how many times to scan a table when looking for data etc... You would end up with 6 times the number of places SQL Server has to go retrieve this informaiton if you break it up. You said your tables have 800 rows. Times 6 that is a measly 4,800 records. 800 or 4.800 is not significant number of records to SQL Server. I would say create one table and create an index on those fields most commonly searched so SQL server can be as fast as possible retrieving the data, and index any fields you may use for joining to other tables if they are not already part of a foreign key (which they should be).

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Really basic query speed question..


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway