Re: (Select *) vs. (Select id) from table. - Mailing list pgsql-general

From Doug McNaught
Subject Re: (Select *) vs. (Select id) from table.
Date
Msg-id 87wtha6yvr.fsf@asmodeus.mcnaught.org
Whole thread Raw
In response to Re: (Select *) vs. (Select id) from table.  (Scott Ribe <scott_ribe@killerbytes.com>)
List pgsql-general
Scott Ribe <scott_ribe@killerbytes.com> writes:

>> The time the DB needs to find the record
>> should be the same since the record has to be found before the resultset is
>> assembled.
>
> What if the query can be satisfied from an index? I don't know if PostgreSQL
> has this kind of optimization or not.

Nope.  Tuple visibility isn't stored in indexes, so it still has to
visit the heap to see if a row is visible to your transaction.

-Doug

pgsql-general by date:

Previous
From: Scott Ribe
Date:
Subject: Re: (Select *) vs. (Select id) from table.
Next
From: Postgres User
Date:
Subject: Re: Installing Postgres 8.1 on Windows Server 2003 R2