Re: Efficient query to fetch the columns in an entire relation?

From: Tobin Harris <comedyharris_at_hotmail.com>
Date: Wed, 17 Jul 2002 16:00:13 +0100
Message-ID: <ah40q1$q2b6f$1_at_ID-135366.news.dfncis.de>


> Yesterday, I came across one simple question yet interesting.
>
> What is the best way of retrieving all columns in a given relation
> using a SQL query.
>
> Two possible alternatives are
>
> 1. SELECT * FROM relation_name;
>
> 2. SELECT COLUMN1, COLUMN2, ..., COLUMNn FROM relation_name;
>
> I am not able to decide, which is better than the other and more
> importantly
> WHY?
I'm pretty sure that option 2 is best. If you explicitly state the columns you want, the database doesn't have to waste effort querying the data-dictionary to work out what columns are available to select.

Tobin

> Hope to get some reply on this,
>
> - Vijay
Received on Wed Jul 17 2002 - 17:00:13 CEST

Original text of this message