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

From: Kasahara Tatsuhito <kasahara(dot)tatsuhito(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(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:24:44
Message-ID: CAP0=ZV+gdKVNxoy90-imBOvFR2P2SZXeDDSBaU7=SAGcWxaAmA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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 ?

--
Tatsuhito Kasahara
kasahara.tatsuhito _at_ gmail.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2016-02-23 15:32:29 Re: BUG #13979: Strange pg_stat_statements results with PREPARE/EXECUTE
Previous Message ranier_gyn 2016-02-23 15:04:47 BUG #13983: HANDLE LEAK