Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDy18-0004aG-U0 for pgsql-general@arkaria.postgresql.org; Fri, 27 Sep 2019 21:43:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iDy17-0004Kp-Ic for pgsql-general@arkaria.postgresql.org; Fri, 27 Sep 2019 21:43:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDy17-0004Kh-6L for pgsql-general@lists.postgresql.org; Fri, 27 Sep 2019 21:43:09 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1iDy14-0002BW-7P for pgsql-general@postgresql.org; Fri, 27 Sep 2019 21:43:07 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 0713F177E6DF7 for ; Fri, 27 Sep 2019 14:43:05 -0700 (MST) Date: Fri, 27 Sep 2019 14:43:04 -0700 (MST) From: PegoraroF10 To: pgsql-general@postgresql.org Message-ID: <1569620584962-0.post@n3.nabble.com> Subject: steps of a sql MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Some days ago one of my customers claimed that one of his queries were spending too much time. Then on postgres log it appears really strange. Tha= t query doesn=C2=B4t usually appears as parse, sometimes only as execute, bec= ause it tooks almost all times less than 500ms. But on that day something happened, what was that, PARSE time of 10 minutes ? Command_Tag Message PARSE duration: 552607.263 ms parse PRSTMTST13817971293: WITH ... SELECT duration: 1211.195 ms execute PRSTMTST13955596862/PORTALST13955596862: WITH ... PARSE duration: 673398.585 ms parse PRSTMTST13857292877: WITH ... SELECT duration: 2742.588 ms execute PRSTMTST13817971293/PORTALST13817971293: WITH ... SELECT duration: 1318.766 ms execute PRSTMTST13844185613/PORTALST13844185613: WITH ... Then, I didn=C2=B4t find in the docs what are the steps of execution of a q= uery and obviously why that SQL took so long. These 5 examples are the same query, so it doesn=C2=B4t make sense that I=C2=B4ll wait 10 minutes do pars= e and just 1 or 2 seconds to execute. So, the quetion is, how can I know if I=C2=B4m r= unning a simple query or a extended query, like the docs explain on https://www.postgresql.org/docs/11/protocol-flow.html and what can I do to find what happened and solve to never occur again. -- Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.h= tml