public inbox for [email protected]  
help / color / mirror / Atom feed
From: Daniele Varrazzo <[email protected]>
To: David Raymond <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: CPU usage for queries, psycopg 2 vs 3
Date: Thu, 7 Sep 2023 00:05:43 +0100
Message-ID: <CA+mi_8Z98u3Gq-3JrAbWRW7ar9hhPAO5umze==xgpEHdxdcPKQ@mail.gmail.com> (raw)
In-Reply-To: <DB7PR07MB3916A230837909499A87EF3287E8A@DB7PR07MB3916.eurprd07.prod.outlook.com>
References: <DB7PR07MB3916A230837909499A87EF3287E8A@DB7PR07MB3916.eurprd07.prod.outlook.com>

On Tue, 5 Sept 2023 at 18:52, David Raymond <[email protected]> wrote:
>
> I've noticed that CPU usage for queries seems to have drastically increased going from psycopg2 to psycopg3.

Hello David,

thank you for the report. No, this is not expected: psycopg 3 uses I/O
completion functions to wait idle for results from the server, so it
shouldn't consume more cpu than psycopg2. I will investigate (but on
Linux, I don't have a Windows machine handy to test with).

There was a change in the waiting function in psycopg 3.1.5, related
to <https://github.com/psycopg/psycopg/issues/414;. I wonder if it was
a regression with that change? Could you please be so kind as to
repeat your tests with psycopg 3.1.4?

Also, did you try only to connect on localhost? Are you able to run
the same test with a server running on a different network location?

Thank you very much

-- Daniele





view thread (9+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: CPU usage for queries, psycopg 2 vs 3
  In-Reply-To: <CA+mi_8Z98u3Gq-3JrAbWRW7ar9hhPAO5umze==xgpEHdxdcPKQ@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox