Re: two functions in query doubles time??

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Sim Zacks" <sim(at)compulab(dot)co(dot)il>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: two functions in query doubles time??
Date: 2005-03-06 19:34:38
Message-ID: 6155.1110137678@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Sim Zacks" <sim(at)compulab(dot)co(dot)il> writes:
> I have a view that selects 2 functions, plus other data from a view and 2
> tables.
> A Select * on the join take approximately 1.3 seconds.
> Select function a() from the join takes about 1.3 seconds.
> select function b() from the join takes about 1.3 seconds.
> select a(),b() from the join takes about 2.5 seconds.

You sure about the first of those statements? The explain results sure
look like it's the "functions" that are eating the bulk of the runtime.

> I am looking at the Explain Analyze for the previous 3 queries and it looks
> like a number of the joins are taking 50% longer in the last query.
> Does this make sense? Is there a reason for this?

The estimated row widths are different, implying that different sets of
columns are being pulled from the underlying tables. Pushing more
columns around certainly affects the runtime. (Depending on what
else is in the tables, I suppose this could explain why "select *"
seems so expensive.)

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message NTPT 2005-03-06 20:07:33 Re: More concurent transaction over single connection
Previous Message Hagop Hagopian 2005-03-06 19:34:01 Re: [CYGWIN] PostgreSQL installation problem on Windows XP Home