Re: BUG #13979: Strange pg_stat_statements results with PREPARE/EXECUTE

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Kasahara Tatsuhito <kasahara(dot)tatsuhito(at)gmail(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #13979: Strange pg_stat_statements results with PREPARE/EXECUTE
Date: 2016-02-23 15:32:29
Message-ID: CAKFQuwbqc=L3LfH-aNBCyipjg3hjWe6nSBaLwBCr-abMSxxtCQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Feb 23, 2016 at 8:24 AM, Kasahara Tatsuhito <
kasahara(dot)tatsuhito(at)gmail(dot)com> wrote:

> 2016-02-23 23:36 GMT+09:00 David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>:
> > You need to tell people what exactly you think is strange/what you would
> > expect to see.
> Yeah.
>
> So I expected following result after performing second time "SELECT *
> FROM tt WHERE c1 = $1" in a previous e-mail.
>
> =# SELECT queryid, calls, query FROM pg_stat_statements WHERE query LIKE
> '%tt%';
> queryid | calls | query
> -----------+-------+----------------------------------------------------
> 575935600 | 1| PREPARE p1(int) AS SELECT * FROM tt WHERE c1 = $1;
> other-queryid | 10 | SELECT * FROM tt WHERE c1 = $1;
> (2 row)
>
> But actually SELECT was counted as PREPARE in pg_stat_statements.
> That's what I thought strange.
>
> It seems to me that "<query>" and "PREPARE <query>" always have same
> queryid.
> Therefore should I consider these queries as the same one ?
>
>
​What do you think the following statement does?


PreparedStatement ps1 = con.prepareStatement(sql1);

​David J.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2016-02-23 15:38:08 Re: BUG #13979: Strange pg_stat_statements results with PREPARE/EXECUTE
Previous Message Kasahara Tatsuhito 2016-02-23 15:24:44 Re: BUG #13979: Strange pg_stat_statements results with PREPARE/EXECUTE