Re: I want to make an example of using parameterized path

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: 高健 <luckyjackgao(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: I want to make an example of using parameterized path
Date: 2013-06-18 17:02:12
Message-ID: CAMkU=1y0fXLrNuvsev989RUiYrQNg4S1xVawwmAAnzC=yaiv_A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jun 18, 2013 at 2:09 AM, 高健 <luckyjackgao(at)gmail(dot)com> wrote:

> postgres=# explain execute s(2);
>
> QUERY PLAN
>
> ---------------------------------------------------------------------------------
>
> Index Only Scan using idx_tst01_id on tst01 t (cost=0.00..8.38 rows=1 width=4)
>
> Index Cond: (id < 2)
>
> (2 rows)
>
>
> postgres=# explain execute s(100000);
>
> QUERY PLAN
>
> ---------------------------------------------------------------
>
> Seq Scan on tst01 t (cost=0.00..1693.00 rows=100000 width=4)
>
> Filter: (id < 100000)
>
> (2 rows)
>
>
>
> postgres=#
>
>
>
> When I just send sql of " select * from tst01 t where id <2" , it will
> also produce index only scan plan.
>
> When I just send sql of " select * from tst01 t where id < 100000", it
> will also produce seq scan plan.
>
>
>
> So I think that the above example can not show that "parameterized path"
> has been created.
>

But if you try the PREPAREd sets in versions before 9.2, you will find they
use the same plan as each other. Allowing them to differ based on the
parameter they are executed with, just like the non-PREPARE ones differ, is
what parameterized paths is all about.

Cheers,

Jeff

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message bhanu udaya 2013-06-18 17:31:31 Postgres DB crashing
Previous Message Robert Fitzpatrick 2013-06-18 15:54:19 Using functions to calc field values in other table