public inbox for [email protected]  
help / color / mirror / Atom feed
From: Laurenz Albe <[email protected]>
To: David Mullineux <[email protected]>
To: Siraj G <[email protected]>
Cc: [email protected]
Subject: Re: Help with query optimizer
Date: Tue, 01 Oct 2024 12:39:02 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAGsyd8V9XOBpOOrg+jvmJ4L56ATyj8kZMZ2w4-9T-CVMWBcPTw@mail.gmail.com>
References: <CAC5iy60_cx-d=0eXNgzX9bmZepFaZ3isqyX=D=UpxUcOgW+9cg@mail.gmail.com>
	<CAGsyd8V9XOBpOOrg+jvmJ4L56ATyj8kZMZ2w4-9T-CVMWBcPTw@mail.gmail.com>

On Tue, 2024-10-01 at 09:36 +0100, David Mullineux wrote:
> > On Tue, 1 Oct 2024, 08:53 Siraj G, <[email protected]> wrote:
> > Can you please help with the attached query as it is taking time to
> > execute. The execution plan for the same is below:
> >
> > [EXPLAIN (ANALYZE, BUFFERS) output]
>
> Its usually helpful to give some details on what 'slow' means and then define what
> 'fast enough ' means. Just so we know when to stop optimizing.
> You should also help by giving the DDL of those.tables and any indexes they have etc..

Table definitions and the actual query text would be most helpful, yes.

The PostgreSQL version is essential too.

> The plan shows me that there are expensive seq scans on 2 tables : conversations and tasks.

Those sequential scans are quite cheap; there is nothing to optimize.
The time is spent in two index scans that are repeated a lot, because they
are on the inner side of a nested loop:

- the index scan on "messages" is repeated 53708 times
- the index scan on "mailMessages" is repeated 173750 times


Yours,
Laurenz Albe






view thread (2+ messages)

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], [email protected], [email protected]
  Subject: Re: Help with query optimizer
  In-Reply-To: <[email protected]>

* 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