In a case where I'm not sure how many columns Im going to use should I just
use
select * from table1
or
select col1, col2, col3, col4... from table1
Is there any divantage for using select * in terms of performance or
security?
Thanks,
HowardThe Best Practice is to specify only those columns you actually use. This
will give the optimizer more flexibility, such as choosing covering
non-clustered indexes, and also reduce network bandwidth requirements. The
column list technique also provides a more well-defined application
interface that doesn't change when columns are added to tables.
From a security perspective, a column list provides vertical partitioning so
that data is selectively exposed.
Hope this helps.
Dan Guzman
SQL Server MVP
"Howard" <howdy0909@.yahoo.com> wrote in message
news:%238Bik$6eGHA.2076@.TK2MSFTNGP04.phx.gbl...
> In a case where I'm not sure how many columns Im going to use should I
> just use
> select * from table1
> or
> select col1, col2, col3, col4... from table1
> Is there any divantage for using select * in terms of performance or
> security?
> Thanks,
> Howard
>
Monday, March 26, 2012
performance questions
Labels:
case,
col1,
col2,
col3,
col4,
columns,
database,
justuseselect,
microsoft,
mysql,
oracle,
performance,
server,
sql,
table1orselect
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment