Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6147315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:05:20+00:00 2026-05-23T19:05:20+00:00

Possible Duplicates: Performance issue in using SELECT * ? What is the reason not

  • 0

Possible Duplicates:
Performance issue in using SELECT * ?
What is the reason not to use select *?

I recall reading a blog some time ago that detailed performance issues with using an asterisk to select all columns of a table in MySQL, and I can no longer find it. I’m using a combination of MySQL and PHP’s PDO driver (and therefore prepared statements), and the asterisk would naturally speed up the maintenance of a lot of my SQL queries.

Would you consider it to be acceptable practice to use the asterisk? If not, what are you reasons (security/performance/standards wise)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:05:21+00:00Added an answer on May 23, 2026 at 7:05 pm

    There is a list of issues with using select *.

    1 – consistency of output
    If your client expects certain fields and you change the layout of a table, select * will change its output if the underlying tables changes, breaking your client code.

    2 – Network performance
    If you only need a subset of all field in the output, select * will waste network bandwidth by sending unneeded data across the wire.

    3a – Database performance
    On simple tables select * may not slow performance down, but if you have blob fields (that you’re not interested in) select * will fetch those as well, killing performance

    3b – Memory usage on the database server
    If MySQL needs to use a temporary table, select * will tax the servers, disk, memory and CPU extra by making MySQL store more data in memory.

    3c – On InnoDB covering indexes cannot be used
    On InnoDB if you select fields that are indexed, MySQL needs never to read the actual table data, it just reads the info straight from the index, select * kills this optimization.

    4 – Clarity of code
    select * gives the reader of a query no info on which fields will be retrieved from the server. select name, address, telephone from ... makes it instantly clear what data we are dealing with.
    If your tables are in Zulu you can even do

    select
      igama as name
      ikheli as address
      ....
    

    Which is much more useful than the original names for the 99.7% of the people that don’t speak Zulu.

    5 – Don’t hack code, craft it
    Select * is just a quick hack to make stuff work.
    But when you write code you’re supposed to have an idea what you’re doing, make that explicit, select what you need, give fields meaningful name using aliases if needed.
    Tweak your code to select only what you need.
    If I see a select * in a code review, I mark it down sight unseen because it’s a code smell.

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicates: Why is lock(this) {...} bad? In C# it is common to use
Possible Duplicates: Valid use of goto for error management in C? Examples of good
Possible Duplicates: Which loop has better performance? Why? Which is optimal ? Efficiency of
Possible Duplicates: Is "else if" faster than "switch() case"? What is the relative performance
Possible Duplicates: Pass by value vs Pass by reference performance C#.net Did anyone already
Possible Duplicates: Implementing a matrix, which is more efficient - using an Array of
Possible Duplicates: Select * vs Specifying Column Names Which is faster/best? SELECT * or
Possible Duplicates: Benefits of using the conditional ?: (ternary) operator Is the conditional operator
Possible Duplicate: Performance of try-catch in php While using try - catch blocks, even
Possible Duplicates: Why would someone use #define to define constants? difference between a macro

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.