Hi Mark,
The short answer is "it depends". (BG) Generally speaking, it's not usually a good idea to use SELECT * in a query -- I always specify a column list in any code I plan to use more than once (g). Additionally, you can quickly cause a Cartesian product if you use SELECT * with any kind of join condition. The number of columns in the table usually doesn't make much difference in the speed of the query.
However, there's a *LOT* more to optimizing a query than just choosing a list of fields rather than taking all the available fields.
Ignoring, for the moment, any conditions involving the hardware, configuration, or infrastructure that you're running the query through and/or against --
- does the query have a WHERE clause?
- are the columns/fields in the WHERE clause indexed?
- are there any text/memo fields being chosen in the list?
- are there any join conditions / child tables?
- are you selecting data from VFP, SQL, Oracle, or DB2?
- what type of connection methodology (views, SPT, ADO, CursorAdapters) are you using?
These are just some of the items to consider -- others will have more (I'm sure).
HTH.
>i have an easy one for someone, do you know what is faster, a select * from a database or a select followed by the fields, say for example the number of fields to be used was 5? am trying to eck out a little performance and wonder if this may help on tables with maybe 30+ fields
>Cheers
>~M
Evan Pauley, MCP
Positronic Technology Systems LLC
Knoxville, TN
If a vegetarian eats vegetables, what does a humanitarian eat?