I’ve heard that SELECT * is generally bad practice to use when writing SQL commands because it is more efficient to SELECT columns you specifically need.
If I need to SELECT every column in a table, should I use
I’d advice to use what is better understandable when reading the code.
For me select * is faster to understand when I’m reading code.
But it also will depend on many cases, like, will you add new columns in the future that you may not need in this query ? etc
I think for now this is an unnecessary micro optimization and pick whichever looks better to you.
Hi @ivan_s,
As a general rule of thumb, it is better to avoid scanning all columns of the table and instead just scan the columns that your application needs (using SELECT column1, column2..), for better query performance.
Additionally, it also makes sure that your application is not impacted if there are any changes to the table in future, like addition of new columns, or removal of unused columns.