Re: Slow running query

From: Shrikant Bhende <shrikantpostgresql(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Slow running query
Date: 2019-12-12 07:00:59
Message-ID: CAMTQpJCLVQkubRW-fsrG93sMxuxO=1hv3DbTULWLsUjF3+BxLw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hello Tom,

Thanks for the suggestion, I will try to tune the mentioned functions.

Thanks and regards

On Wed, Dec 11, 2019 at 9:02 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Shrikant Bhende <shrikantpostgresql(at)gmail(dot)com> writes:
> > Below is the query which is running very slow, can anyone suggest any
> > improvement for the same to make it faster.
>
> Not when you haven't given us any supporting data :-(. There's some
> advice about how to ask useful performance questions here:
>
> https://wiki.postgresql.org/wiki/Slow_Query_Questions
>
> However, just scanning your EXPLAIN output, it seems that the bulk
> of the time is being spent inside two user-defined functions:
>
> > -> Function Scan on
> get_num_connections f (cost=0.25..10.25 rows=1000 width=24) (actual
> time=22331.461..22331.479 rows=263 loops=1)
> ...
> > -> Function Scan on
> get_num_proprietary f_1 (cost=0.25..10.25 rows=1000 width=24) (actual
> time=4052.081..4052.085 rows=26 loops=1)
> ...
> > Planning time: 18.362 ms
> > Execution time: 33944.679 ms
>
> ie, 26 of the 34 seconds are being spent there. You're not going to be
> able to move the needle very far unless you can make those a lot cheaper.
>
> I notice that the first thing the plan does with these is FULL JOIN them
> to each other, which seems suspiciously like a performance anti-pattern.
>
> regards, tom lane
>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Laurenz Albe 2019-12-12 14:08:16 Re: Insert hex / octal literals in a query?
Previous Message S.Bob 2019-12-12 04:07:13 Insert hex / octal literals in a query?