Wednesday, March 28, 2012

How to make query result fast

I have around 5 items in my database. It takes me about 1-
2 minutes to show up all the result. How can I make my
query result faster? I try to select everything on my
product table.
Hi,
Did you mean 5 tables and on running a query against this 5 tables takes 2
minutes.
The speed depends up on the availability of data in each of your tables, If
you have more records in table then create indexes based on your queries
Where condition.
This will defenetely speed up the retrieval time.
Note:
Use the Query -- Execution plan option inside Query analyzer to tune the
query.
Thanks
Hari
MCDBA
"ping" <anonymous@.discussions.microsoft.com> wrote in message
news:667501c42e80$9e398d80$a001280a@.phx.gbl...
> I have around 5 items in my database. It takes me about 1-
> 2 minutes to show up all the result. How can I make my
> query result faster? I try to select everything on my
> product table.
|||I would say that this is a little open ended question. Speed of the query
is not related to just one aspect.
Lets take scenarios here. First, lets assume that you have one table with
only 5 rows in it. But each row has 150 columns (say for the sake of
discussion). So if you run a query which is like SELECT * FROM TABLEA, this
is gonna take a lot of time, as this will have to result all the columns
from the table. Therefore, a better way would be to select only those
columns that you actually need in your result set. Say if you need only
5-10 columns, then there is no need to return 150 columns.
Second, lets assume that you 2000 rows but each row has only 3 columns.
Even if you return all the columns, your query will still be fast. So you
dont have to worry.
Another way to fasten your results is to have indexes created on each
table. This will also fasten up your results. You can even analyse your
query performance by making use of the Query Execution plan.
So at the end of the day, it depends. Your query is slightly open ended so
I would recommend that you re-visit it and evaluate it further to see its
performance cost.
Sanchan [MSFT]
sanchans@.online.microsoft.com
This posting is provided "AS IS" with no warranties, and confers no rights.

No comments:

Post a Comment