Loading ...

How to find the query is optimised or not?

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  data access   » How to find the query is optimised or not?

How to find the query is optimised or not?

Posts under the topic: How to find the query is optimised or not?

Posted: 10/15/2009

Contributor 2841  points  Contributor
  • Joined on: 11/29/2008
  • Posts: 62

Hi,
I have a table with name user,this table contains 5 columns.
Now I want to select all these 5 columns,there is two ways to do this

1. Select * From User
2. Select [ColumnName1],[ColumnName2]....[ColumnName5] From User

Both Query Gives me the same results.
Now my question is that in both the Queries which one is  optimised query,
and how we find out the optization of the queries


tags Sql

Posted: 10/15/2009

Professional 8338  points  Professional
  • Joined on: 4/15/2009
  • Posts: 424
  Answered

I'm not a SQL expert but IMOH, If you are going to select certain columns in a Table then i would prefer Option 2. this would increase the performance of your query because you are only filtering the wanted columns in the table..

Here's a useful article that you can refer on : How To: Optimize SQL Queries


Posted: 2/18/2010

Lurker 215  points  Lurker
  • Joined on: 12/28/2009
  • Posts: 11

Vijjendra said:

1. Select * From User
2. Select [ColumnName1],[ColumnName2]....[ColumnName5] From User

Both Query Gives me the same results.
Now my question is that in both the Queries which one is  optimised query,
and how we find out the optization of the queries

You can run the sql profiler to check which query takes more time to run...

please visit this

http://searchsqlserver.techtarget.com/tip/0,289483,sid87_gci1171978,00.html


Posted: 2/18/2010

Contributor 2841  points  Contributor
  • Joined on: 11/29/2008
  • Posts: 62
  Answered

Thanks yrbyogi  and Vinz
I got my question's answer from the following link:
http://stackoverflow.com/questions/321299/what-is-the-reason-not-to-use-select


Posted: 2/22/2010

Lurker 192  points  Lurker
  • Joined on: 10/23/2009
  • Posts: 20

dear sir i go through the link which you had mationed in ur answer bt i am still in confusion

will you please make yhe point clera

 


Page 1 of 1 (5 items)