On 9/17/2023 5:01 AM, Albert-Jan Roskam via Python-list wrote:
    On Sep 15, 2023 19:45, "Peter J. Holzer via Python-list"
    <python-list@python.org> wrote:

      On 2023-09-15 17:42:06 +0200, Albert-Jan Roskam via Python-list wrote:
      >    This is more related to Postgresql than to Python, I hope this is
      ok.
      >    I want to measure Postgres queries N times, much like Python timeit
      >    (https://docs.python.org/3/library/timeit.html). I know about
      EXPLAIN
      >    ANALYZE and psql \timing, but there's quite a bit of variation in
      the
      >    times. Is there a timeit-like function in Postgresql?

      Why not simply call it n times from Python?

      (But be aware that calling the same query n times in a row is likely to
      be
      unrealistically fast because most of the data will already be in
      memory.)

    =====
    Thanks, I'll give this a shot. Hopefully the caching is not an issue if I
    don't re-use the same database connection.

Here is a stack overflow thread that gives a good rundown of ways to get timings from Postgres:

https://stackoverflow.com/questions/9063402/get-execution-time-of-postgresql-query

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to