performance and number of selected columns

Lists: Postg스포츠 토토 결과SQL
From: Dirk Lutzebaeck <lutzeb(at)aeccom(dot)com>
To: pgsql-general(at)hub(dot)org
Subject: performance and number of selected columns
Date: 2000-05-22 15:25:04
Message-ID: 14633.20816.626234.631719@ampato.core.aeccom.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg스포츠 토토 결과SQL


Hi,

say I have three tables a,b,c with lots of columns (say 10 for each
table). Using psql command line, why does

SELECT a.*,b.*,c.* FROM a,b,c

takes much more longer (in my specifc case 3 times) than only
selecting one column like

SELECT a.oid, b.oid, c.oid FROM a,b,c.

This is on 7.0. Can I play with buffer sizes? Indexes exist on most
of the columns. Columns in the second line can be arbitrary.

Dirk


From: Dirk Lutzebaeck <lutzeb(at)aeccom(dot)com>
To: pgsql-general(at)hub(dot)org
Subject: Re: performance and number of selected columns
Date: 2000-05-22 15:56:02
Message-ID: 14633.22674.316652.283601@ampato.core.aeccom.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Dirk Lutzebaeck writes:
>
> Hi,
>
> say I have three tables a,b,c with lots of columns (say 10 for each
> table). Using psql command line, why does
>
> SELECT a.*,b.*,c.* FROM a,b,c
>
> takes much more longer (in my specifc case 3 times) than only
> selecting one column like
>
> SELECT a.oid, b.oid, c.oid FROM a,b,c.
>
> This is on 7.0. Can I play with buffer sizes? Indexes exist on most
> of the columns. Columns in the second line can be arbitrary.

Two things two add:

- EXPLAIN shosw the same results in both cases
- currently I was working with ~ 500 rows

Dirk


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dirk Lutzebaeck <lutzeb(at)aeccom(dot)com>
Cc: pgsql-general(at)hub(dot)org
Subject: Re: performance and number of selected columns
Date: 2000-05-22 15:58:06
Message-ID: 18117.959011086@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Dirk Lutzebaeck <lutzeb(at)aeccom(dot)com> writes:
> say I have three tables a,b,c with lots of columns (say 10 for each
> table). Using psql command line, why does
> SELECT a.*,b.*,c.* FROM a,b,c
> takes much more longer (in my specifc case 3 times) than only
> selecting one column like
> SELECT a.oid, b.oid, c.oid FROM a,b,c.

I'd guess you are simply looking at the increased time to transfer
the additional data to the frontend, format it for display, etc.
With a pure cartesian-product join like that (no WHERE), the backend
is basically going to be spitting out tuples as fast as it can read
them from disk...

regards, tom lane