Re: How to schedule long running SQL job - Mailing list pgsql-admin
From | John Scalia |
---|---|
Subject | Re: How to schedule long running SQL job |
Date | |
Msg-id | C50F0B6C-B557-4139-93F5-9B18D58ACF4F@gmail.com Whole thread Raw |
In response to | Re: How to schedule long running SQL job (M Sarwar <sarwarmd02@outlook.com>) |
Responses |
Re: How to schedule long running SQL job
|
List | pgsql-admin |
On Jul 19, 2023, at 7:57 PM, M Sarwar <sarwarmd02@outlook.com> wrote:
From my laptop on powershell and dos prompt, it is saying tht pg_cron is not recognized.Do I need anything new installation for this?Thanks,SarwarFrom: John Scalia <jayknowsunix@gmail.com>
Sent: Wednesday, July 19, 2023 7:45 PM
To: M Sarwar <sarwarmd02@outlook.com>
Cc: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Re: How to schedule long running SQL jobTry pg_cron. I know later versions support it.Sent from my iPadOn Jul 19, 2023, at 7:41 PM, M Sarwar <sarwarmd02@outlook.com> wrote:Hi,Db: PostgresCloud: aws / RDSTool using so far: PgAdminSQL got aborted after running for 1 hr 40 minutes from pgadmin.I need CSV file output.What is the recommended approach for this issue.SQL:SELECT P1.FILE_ID,
F.FILENAME,
P1.STAGE,
P1.SERIAL_NUMBER,
P1.TEST_IMAGE_SET_VALUE,
SUBSTRING(P1.SERIAL_NUMBER, '[A-Z][0-9]+') AS MCM_ID_SERIAL_NUMBER,
P1.RUN_ID,
SPLIT_PART(P1.RUN_ID, ':', 1) TEST_LOT
FROM BRONX.TEST_PART_DETAILS_ALL_MCM P1,
BRONX.FILES_METADATA F
WHERE F.FILE_ID = P1.FILE_ID
AND EXISTS ( SELECT SUBSTRING(P2.SERIAL_NUMBER, '[A-Z][0-9]+') AS MCM_ID2 ,
COUNT(DISTINCT SPLIT_PART(P2.RUN_ID, ':', 1)) AS NUM_DISTINCT_TEST_LOTS
FROM BRONX.TEST_PART_DETAILS_ALL_MCM P2
WHERE SUBSTRING(P2.SERIAL_NUMBER, '[A-Z][0-9]+') = SUBSTRING(P1.SERIAL_NUMBER, '[A-Z][0-9]+')
GROUP BY MCM_ID2
HAVING COUNT(DISTINCT SPLIT_PART(P2.RUN_ID, ':', 1)) > 1
)
order BY MCM_ID_SERIAL_NUMBER,
TEST_LOT ;
I used to use crontab or OEM to schedule these types jobs in the past. Now it is on RDS/AWS.Thanks,Sarwar
pgsql-admin by date: