[GENERAL] Select All Columns

2005-09-01 Thread Tan Chen Yee
If I want to retrieve all columns from a table, is there any disadvantage by
using select *
instead of listing all the columns ? Will select * cause overhead, more
times to run ?

Thanks !

Tan


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [GENERAL] Select All Columns

2005-09-01 Thread Douglas McNaught
"Tan Chen Yee" <[EMAIL PROTECTED]> writes:

> If I want to retrieve all columns from a table, is there any disadvantage by
> using select *
> instead of listing all the columns ? Will select * cause overhead, more
> times to run ?

No, it shouldn't make any difference there.  The disadvantage of
SELECT * is that adding, removing or changing columns can break your
client code (depending on what client library you're using) because
the records returned by a query will change format without warning.

-Doug

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [GENERAL] Select All Columns

2005-09-01 Thread Bob
The first question is do you really need all the columns. Most times
you don't need them. There will be network overhead for sure in
returning all columns instead of just the few that you want. Also
select * is not very clear with what is going on in the statement. 
Where I work we have standards to always qualify the columns by name
and to not use the *.Another issue I have seen is that if your code
logic assumes that select * returns
column1 column2 column3 and you add a new column to that table your
logic can break.  I often see the select * used when people get lazy. 
To me select * should only be used in ad-hoc fashion when digging
around in tables and such.

Just my 2 cents






umn

On 9/1/05, Tan Chen Yee <[EMAIL PROTECTED]> wrote:
> If I want to retrieve all columns from a table, is there any disadvantage
> by
> using select *
> instead of listing all the columns ? Will select * cause overhead, more
> times to run ?
> 
> Thanks !
> 
> Tan
> 
> 
> ---(end of broadcast)---
> TIP 1: if posting/reading through Usenet, please send an appropriate
>subscribe-nomail command to [EMAIL PROTECTED] so that your
>message can get through to the mailing list cleanly
>

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
   choose an index scan if your joining column's datatypes do not
   match