Query Tunning related to function - Mailing list pgsql-performance

From Kumar, Mukesh
Subject Query Tunning related to function
Date
Msg-id CH0P221MB04744DB33957A93BB2F7782EDEEF9@CH0P221MB0474.NAMP221.PROD.OUTLOOK.COM
Whole thread Raw
Responses Re: Query Tunning related to function  (Ranier Vilela <ranier.vf@gmail.com>)
Re: Query Tunning related to function  (Justin Pryzby <pryzby@telsasoft.com>)
List pgsql-performance

Hi Team,

 

We are running the below query in PostgreSQL and its taking approx. 8 to 9 sec to run the query.

 

Query – 1

 

Select * from

  (

  Select payment_sid_c,

  lms_app.translate_payment_status(payment_sid_c) AS paymentstatus

  from

  lms_app.lms_payment_check_request

  group by payment_sid_c) a 

  where  paymentstatus in ('PAID', 'MANUALLYPAID')

 

 

The explain plan and other details are placed at below link for more information. We have checked the indexes on column but in the explain plan it is showing as Seq Scan which we have to find out.

 

 

https://explain.depesz.com/s/Jsiw#stats

 

 

This query is using a function translate_payment_status on column payment_sid_c whose script is attached in this mail

 

Could please anyone help or suggest how to improve the query performance.

 

Thanks and Regards,

Mukesh Kumar

 

Attachment

pgsql-performance by date:

Previous
From: Justin Pryzby
Date:
Subject: Re: An I/O error occurred while sending to the backend (PG 13.4)
Next
From: Goti
Date:
Subject: SQL performance issue after migration from Oracle to Aurora postgres