Re: Query Plan choice with timestamps

From: Giorgio Valoti <giorgio_v(at)mac(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Query Plan choice with timestamps
Date: 2008-08-08 05:38:10
Message-ID: 3CA742D3-1D67-4572-AD4A-F7AA479771C7@mac.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance


On 07/ago/08, at 23:01, Tom Lane wrote:

> Giorgio Valoti <giorgio_v(at)mac(dot)com> writes:
>> On 07/ago/08, at 17:50, Tom Lane wrote:
>>> These numbers seem pretty bogus: there is hardly any scenario in
>>> which a
>>> full-table indexscan should be costed as significantly cheaper
>>> than a
>>> seqscan. Have you put in silly values for random_page_cost?
>
>> No,
>
> I looked at it more closely and realized that the cost discrepancy is
> from the evaluation of the function: having to evaluate a SQL or
> plpgsql
> function 247736 times more than explains the cost estimate
> differential
> compared to a query that involves no function call. Some experiments
> here suggest that it hardly matters whether the query uses indexscan
> or
> seqscan because the time is dominated by the function calls anyway.

I see, thank you Tom. Could it be a good idea adding some notes about
it in <http://www.postgresql.org/docs/8.3/interactive/indexes-expressional.html
>? As you said, since the function call dominates the query cost, in
this case, I think there’s no point to use an index expression.

Ciao
--
Giorgio Valoti

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message dforums 2008-08-08 07:25:18 Restoration of datas
Previous Message Tom Lane 2008-08-08 00:11:14 Re: query planner not using the correct index