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 1h6VVD-0001cp-21 for psycopg@arkaria.postgresql.org; Wed, 20 Mar 2019 07:19:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h6VVA-0002UG-VB for psycopg@arkaria.postgresql.org; Wed, 20 Mar 2019 07:19:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h6Pjh-0001M2-UD for psycopg@lists.postgresql.org; Wed, 20 Mar 2019 01:09:42 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h6Pje-0006ht-GT for psycopg@lists.postgresql.org; Wed, 20 Mar 2019 01:09:40 +0000 Received: by mail-pf1-x42c.google.com with SMTP id c207so621020pfc.7 for ; Tue, 19 Mar 2019 18:09:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uci-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=2VDS4g7B1UsiL8CuE73jy+A70ZTEpDdO8c9gnuXohsU=; b=fGiTJnjnlcwAtavZ1R79sbIYVO8bYieUYiYzhlmc2I5bsE4azqdM7MFsZYFh6d3kMS hcFUq4rPNcIzSnfXrwpyU83UyHddpS84Qeari0E2rEgMKhsvqCHc5G6rVBVHmY+4K9ru U5QIDkxlwvsV37r5J/meCV/lr2pXNlZYYo9ocGgsySjGXNliM7Q8D02Wg1anly2qXiml 2KmxeMJt5sTecUsBcxsopl7EHPvEbQOW5SVD963llup+JAXRqYMHAJPCNWelY9Qa7b0u PBrHYOClN4jfwZ3rGxU0JvtUwzyYW/DFYmbnwYZrH6yIa5MTOhkbLuwrWYxvRjIeSXzC R7Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=2VDS4g7B1UsiL8CuE73jy+A70ZTEpDdO8c9gnuXohsU=; b=kHr8/jzXwlbPx7qzSS2M30VplP7QMU75fRYBmG6cF6cKh5cQWpOlMPSc1L42i4BQX2 TazLzXO/qerDIqO2DRUYUqikU7juuHkRI44Wqi1oT50y0SG2iYsvcS1ICnCMz1KC426S hmByHzzxRVu60tXQpt5DnB+5kqisGubQAt6eD0rZ9YgVIm5K5JiKgUu27usNBot1RGgk m517Xrdu6IrqQeHr/bumQqKJ7ToF5O9/0CPNux6Wu4QjQBh+EVCXFf3VOzVqY9RCdmpf 0C9WIWMTOyx2Dg1DtOPRpCt4Fk+k+D8WlTGpUWAiF1Awrq3kCXu/M+ip1kp+UlCDqEiK nJ9A== X-Gm-Message-State: APjAAAVx1SoQTWGZEjjtMbWG6fu/G2SnoJp+gawCkAnzfmuAJgT7bP6f a3Ol+6dX0m5IRLvjKxv0UIOciLPYXYfA/frIBxH/kHAU X-Google-Smtp-Source: APXvYqze0ZZyb8HXn9+TQeWH/cP1TShxjnbOJ7FvFJ4pVx8j/oUgTIV8Vg/ma5nMS4XMLZVZ9Y2bQyf6cLtLaqiljmk= X-Received: by 2002:aa7:80c8:: with SMTP id a8mr5424741pfn.193.1553044175266; Tue, 19 Mar 2019 18:09:35 -0700 (PDT) MIME-Version: 1.0 From: Xikui Wang Date: Tue, 19 Mar 2019 18:09:22 -0700 Message-ID: Subject: Implicit query plan caching within a connection To: psycopg@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000006337e805847c46e1" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --0000000000006337e805847c46e1 Content-Type: text/plain; charset="UTF-8" Hi Devs, I'm working on a performance test using Psycopg2 + Postgres. My workload is to do a spatial join to use one data point joining two reference tables by repeatedly issuing a query string with different coordinates. The average query execution time that I got is 0.5 ms, which is surprisingly fast. I started a pgsql terminal and analyzed the same query multiple times. The overall execution time is around 1.5ms with ~1ms in planning and 0.5ms in execution. That makes me is that because psycopg2 implicitly cached the plan. Is there any implicit optimization there? Thanks in advance! Best, Xikui --0000000000006337e805847c46e1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Devs,

I'm working on a performan= ce test using Psycopg2=C2=A0+ Postgres. My workload is to do a spatial join= to use one data point joining two reference tables by repeatedly issuing a= query string with different coordinates. The average query execution time = that I got is 0.5 ms, which is surprisingly fast. I started a pgsql=C2=A0te= rminal and analyzed the same query multiple times. The overall execution ti= me is around 1.5ms with ~1ms in planning and 0.5ms in execution. That makes= me is that because psycopg2 implicitly cached the plan. Is there any impli= cit optimization there? Thanks in advance!

Best,
Xikui
--0000000000006337e805847c46e1--