SQL Queries are getting slower

I have a survey site that allows people to sign up for an account and create their own surveys and collect data on my server.

Before I had any customers, the speed of retrieving survey data was very fast.  But, it is becoming progressively slower to retrieve data the more customer accounts there are.  Many accounts have surveys with 20 or 30 questions and with 100+ responses.

I even did a parallel test with the same survey and retrieved survey data from one database that had just one customer account and then one from my current database with 1000+ customer accounts.  In some cases it took 3 minutes on the larger database to pull survey data that could be pulled in just a few seconds with the smaller database.

First of all, why is this happening?  Second of all, I want to determine how to optimize my site (which is written in .net (.aspx) and uses sql 2000 so it will run just as fast with a thousand accounts as it would with one account.

Any thoughts on what could be going on and what I could do to fix this? Thanks.

Andrew
gator93Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

PaulBarbinCommented:
Do you have indexes setup?  
What does the select statement look like?
Have you checked the execution plans?

Paul
0
gator93Author Commented:
Right now I have clustered indexes on the primary key for each table, but that's it.  We are possibly planning to use an index tuning wizard to create non clustered indexes for the tables.  Does that make sense to do that?  Would that increase the performance a lot to do this?

An example of a select statement that we are using is:

select * from survey where ib = 100

What do you mean by check the execution plans?  Can you be more specific.

Thanks.
0
PaulBarbinCommented:
I didn't realize that the queries were that straightforward.  I was asking you to press Ctrl+L (or Ctrl+K) in Query Analyzer to view the execution plan to see if you could determine the difference.  But that's not likely going to help us here.

Is "ib" the column that the clustered index is on?  I am guessing its not.

Paul
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

PaulBarbinCommented:
Also, are you joining on the customer table?

0
gator93Author Commented:

Thats how the majority of the queries are.  There are only a couple of Join queries but none on the customers table.

All tables have a ID, and that is the Primary Id.
0
PaulBarbinCommented:
Give me the entire query that you're running that takes 3 minutes.  Explain the tables involved and give me rough idea on the number of rows in each.

0
gator93Author Commented:
Its not just one query.  Its one page that is doing several queries and the page takes 3 min to come up when it used to take about 20 seconds.
0
PaulBarbinCommented:
Wait, if you don't have ANY nonclustered indexes and you're joining tables, then the problem is likely that you need nonclustered indexes on the foreign key fields.  The execution plan in Query Analyzer would show that.  

Paul
0
gator93Author Commented:
If I run a trace and put that log into the Index Tuning Wizard.  Would it tell me all the nonclustered indexes I should create.
0
PaulBarbinCommented:
I guarantee that if you don't have nonclustered indexes and you are doing joins, that's your problem.  Lets test it and see.  If it doesn't work, then just take them back out.

Paul
0
gator93Author Commented:
But I am only using Joins a couple of times on the whole site.
0
PaulBarbinCommented:
We could go on like this forever!  Either post the queries that you are using joins on, or just create nonclustered indexes for all foreign keys for tables where you are joining using that column.  I can tell you that this will very likely have a significant impact on the query time!

P.S.  I am leaving soon and might not be able to check this post again tonite.  Can you just try one for me quickly?

Paul
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gator93Author Commented:
Ill create nonclustered indexes on all my foreign keys.

Thanks Paul
0
PaulBarbinCommented:
Good luck.  If it doesn't work, post back and we'll take it step by step.

Paul
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.