Re: Query optimization

From: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
To: Durgamahesh Manne <maheshpostgres9(at)gmail(dot)com>
Cc: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Query optimization
Date: 2025-03-14 14:00:31
Message-ID: CAKAnmmJM9xF2xpe48LkA6h0rLPJs9yPbuE7UWA9Gwz-Fzvo4Tw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Mar 13, 2025 at 11:49 PM Durgamahesh Manne <
maheshpostgres9(at)gmail(dot)com> wrote:

> To return one row takes 43ms is not optimal
>

It's actually much faster than that, but even 43ms is overall good. The
query is already pretty optimal, as it uses a single index only scan. There
are a few tricks left to make this potentially faster, but you may want to
look into using some sort of in-memory caching system if your application
is that sensitive to timings. Or find us a version in which the execution
time is not 1/20th of a millisecond and we can work on that one.

Also take a look at pg_stat_statements so you can see how fast the query is
on average.

Cheers,
Greg

--
Crunchy Data - https://www.crunchydata.com
Enterprise Postgres Software Products & Tech Support

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nathan Bossart 2025-03-14 15:42:07 Re: Disabling vacuum truncate for autovacuum
Previous Message mark bradley 2025-03-14 12:10:21 Re: Duplicate Key Values