public inbox for [email protected]
help / color / mirror / Atom feedFrom: Erik Brandsberg <[email protected]>
To: kunwar singh <[email protected]>
Cc: pgsql-sql <[email protected]>
Subject: Re: What is the best way to do this in Postgres
Date: Sun, 8 Dec 2024 12:06:43 -0500
Message-ID: <CAFcck8EkY5D+Q=qOTio4hBVB_yo8rH768eYazRuAKa8OGKkOEA@mail.gmail.com> (raw)
In-Reply-To: <CAJSrDUoBN0KGdBdQKD_tjUFM2LJipefJuQ5GpQrY2iFm8Y2J3Q@mail.gmail.com>
References: <CAJSrDUoBN0KGdBdQKD_tjUFM2LJipefJuQ5GpQrY2iFm8Y2J3Q@mail.gmail.com>
Check the extension ph_cron, while I have never used it, it may be good to
use as part of the solution.
On Sun, Dec 8, 2024, 6:39 AM kunwar singh <[email protected]> wrote:
> Hello Listers,
> Looking for your inputs on the most efficient way to do it in Postgres.
>
> What I want to do:
> ===
> I want to spawn 10 concurrent sessions each executing a complex stored
> procedure with one of the parameters being the product ID.
> Example
>
> CALL process_product(curdate, region, productid=>1) ;
> CALL process_product(curdate, region, productid=>2) ;
> CALL process_product(curdate, region, productid=>3) ;
> CALL process_product(curdate, region, productid=>4) ;
> ...
> CALL process_product(curdate, region, productid=>10) ;
>
>
> Say I get a list of product IDs by running a big query
>
> Product ID
> ====
> 1
> 2
> 3
> 4
> ..
> 10
>
>
> Additional Information
> ===
> Everytime number of product ids will change. At a given time there should
> be no more than 10 concurrent sessions of process_product.
> I want to trigger these procedure calls once every hour. For a given hour
> the number of product IDs could range from 10 to 100 in total.
> I am using RDS Postgres v 15.
>
> Question
> ===
> I know I can create a bash script or Python script , but I am wondering if
> there is a smarter way to do it in Postgres?
>
>
>
> --
> Cheers,
> Kunwar
>
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]
Subject: Re: What is the best way to do this in Postgres
In-Reply-To: <CAFcck8EkY5D+Q=qOTio4hBVB_yo8rH768eYazRuAKa8OGKkOEA@mail.gmail.com>
* 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