Unix Technical Forum

scheduling stored procedure

This is a discussion on scheduling stored procedure within the Pgsql General forums, part of the PostgreSQL category; --> Hi, I have a temporary table in which i store all emails of users who want to receive a ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 12:22 AM
Alain Roger
 
Posts: n/a
Default scheduling stored procedure

Hi,

I have a temporary table in which i store all emails of users who want to
receive a newsletter.
to avoid spamming and to limit the size of this table, i would like to
delete all requests (records) which are older than 72 hours.

i was thinking to execute each hour a stored procedure which will check the
time and date (of now) if it is greater than "registration request time"
stored in this temporary table.
if it is greater, so record will be deleted.

does postgresql have such timer (something like "cron" under unix/linux) ?

thanks a lot,

--
Alain
------------------------------------
Windows XP SP2
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 12:22 AM
Ben
 
Posts: n/a
Default Re: scheduling stored procedure

Traditionally, postgres lets other tools do things they're good at.....
like scheduling scripts to run every hour. I seem to recall there was a
postgres-specific scheduler project somebody started, but I cannot seem to
recall what it was called, much less how far along the project was.

On Sun, 23 Mar 2008, Alain Roger wrote:

> Hi,
>
> I have a temporary table in which i store all emails of users who want to
> receive a newsletter.
> to avoid spamming and to limit the size of this table, i would like to
> delete all requests (records) which are older than 72 hours.
>
> i was thinking to execute each hour a stored procedure which will check the
> time and date (of now) if it is greater than "registration request time"
> stored in this temporary table.
> if it is greater, so record will be deleted.
>
> does postgresql have such timer (something like "cron" under unix/linux) ?
>
> thanks a lot,
>
> --
> Alain
> ------------------------------------
> Windows XP SP2
> PostgreSQL 8.2.4 / MS SQL server 2005
> Apache 2.2.4
> PHP 5.2.4
> C# 2005-2008
>


-
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-10-2008, 12:22 AM
Pavel Stehule
 
Posts: n/a
Default Re: scheduling stored procedure

On 23/03/2008, Alain Roger <raf.news@gmail.com> wrote:
> Hi,
>
> I have a temporary table in which i store all emails of users who want to
> receive a newsletter.
> to avoid spamming and to limit the size of this table, i would like to
> delete all requests (records) which are older than 72 hours.
>
> i was thinking to execute each hour a stored procedure which will check the
> time and date (of now) if it is greater than "registration request time"
> stored in this temporary table.
> if it is greater, so record will be deleted.
>
> does postgresql have such timer (something like "cron" under unix/linux) ?
>


no, but you can try pgAgent
http://www.pgadmin.org/docs/1.4/pgagent.html

> thanks a lot,
>
> --
> Alain
> ------------------------------------
> Windows XP SP2
> PostgreSQL 8.2.4 / MS SQL server 2005
> Apache 2.2.4
> PHP 5.2.4
> C# 2005-2008


-
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-10-2008, 12:22 AM
Raymond O'Donnell
 
Posts: n/a
Default Re: scheduling stored procedure

On 23/03/2008 16:08, Alain Roger wrote:
> i was thinking to execute each hour a stored procedure which will check
> the time and date (of now) if it is greater than "registration request
> time" stored in this temporary table.
> if it is greater, so record will be deleted.
>
> does postgresql have such timer (something like "cron" under unix/linux) ?


Not built in. There's pgAgent which comes with pgAdmin, which ought to
do what you want, though I haven't used it myself. Alternatively, you
can use cron to call psql with the -c option to execute the command you
need run.

Ray.

---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
---------------------------------------------------------------

-
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:23 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com