This is a good topic actually...
 
In days gone past I allways used to use a field list and refrain from using *
 
Simply because this had been drilled into me as being the most performant way 
of selecting data (which it is of course as no lookup is required)
 
But, recently I've started using * again for use with mapping software (such as 
Linq to SQL for example). Its makes it easier to quickly add or remove a column 
from a database table and quickly update the Entity declaration. You dont have 
to then worry about all the custom stored procs etc which would now be broken 
and cause Linq to SQL to blow up as the proc using * will still return all the 
correct columns.
 
I think its the same old story...different techniques are required for 
different scenarios. If your app is heavily used and you need to squeeze every 
bit of juice out of your code then specifying a field list may reduce the 
SELECT by a fraction...but is that performance gain worth the hassel of extra 
development time to re-jig all other procedures...
 
Lee
 
-------
 
Latest Project: 
http://www.jiba-jaba.com
- The home of public microblogging

________________________________

From: [email protected] on behalf of Cerebrus
Sent: Tue 14/04/2009 18:00
To: DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting
Subject: [DotNetDevelopment] Re: gridview




I agree with Joe... I would refrain from using a sweeping statement
like that. And Stephen, what if I did need *all* the columns from a
particular table? ;-)

On Apr 14, 9:15 pm, Joe Enos <[email protected]> wrote:
> Of course, for all of the developers who have a data access layer that
> converts table contents to objects, "select *" is just fine, since the
> data layer probably requires this.  So "NEVER" is a bit strong, don't
> you think?
>
> On Apr 14, 8:06 am, "Stephen Russell" <[email protected]> wrote:
>
>
>
> > For all of you developers please NEVER select "*"
>
> > Try :
> > Select <FieldList> from MyTable
>
> > The least # of Columns out of your data source will ALWAYS be faster.  Isn't
> > that what we strive for?
>
> > ...........................................................................
> > Stephen Russell -
> > Senior Visual Studio Developer, DBA
>
> > Memphis, TN
> > 901.246-0159
>


<<inline: winmail.dat>>

Reply via email to