[Solved] SQL select statement with either ( * ) or (fields names) which performs better?
Looking to automatically optimize YOUR SQL query? Start for free.

EverSQL Database Performance Knowledge Base

SQL select statement with either ( * ) or (fields names) which performs better?

Possible Duplicate:
Which is faster/best? SELECT * or SELECT column1, colum2, column3, etc.

SELECT * FROM tbl1 

and

SELECT field1, field2,...... FROM tbl1

how does SQL engine execute the previous two select statements (step by step) and which one performs better?

How to optimize this SQL query?

The following recommendations will help you in your SQL tuning process.
You'll find 3 sections below:

  1. Description of the steps you can take to speed up the query.
  2. The optimal indexes for this query, which you can copy and create in your database.
  3. An automatically re-written query you can copy and execute in your database.
The optimization process and recommendations:
  1. Avoid Selecting Unnecessary Columns (query line: 2): Avoid selecting all columns with the '*' wildcard, unless you intend to use them all. Selecting redundant columns may result in unnecessary performance degradation.
The optimized query:
SELECT
        * 
    FROM
        tbl1

Related Articles



* original question posted on StackOverflow here.