Solved

stored procedures in postgre || how to script and where

Posted on 2012-03-23
2
1,011 Views
Last Modified: 2012-04-11
I understand that phpPgAdmin cannot call stored procedures on a schedule. I assume I can create a stored procedure in the same way as mySQL since, near as I can tell, the databases have pretty much identical functionality.

But how could I call a procedure every one minute or so. Is the windows task scheduler the best bet? Or should I write it in php and make it a cronjob?

Will SQLserver interfere with php (and vice versa) if they are both attempting to interact with the database at the same time? (connection loss/slowdown)

Thanks!
0
Comment
Question by:hibbsusan
  • 2
2 Comments
 
LVL 22

Accepted Solution

by:
earth man2 earned 500 total points
ID: 37762245
the command line program psql.exe ( psql on Linux ) allows you to call a stored procedure from a script or os one-liner.

Windows has command

at

which allows you to schedule jobs to run at particular times.

Your last point depends on how you define "interfere".  Connection loss should never happen unless something beyond your control occurs or you are trying to do too much with too little !

PostgreSQL is designed as a multi user database.  However when two agents are modifying the database concurrently, what that database looks like to a third party is difficult to define at any point in time.  Many large sites will create master slave DB configurations using log shipping.  You can suspend log shipping if you absolutely must have a static dataset at a point in time and query the slave database that is no longer being kept in sync....

See  -- such a simple question, such a complicated answer.  See documentation for WAL, "log shipping", Slony, pgpool, Bucardo for more details.
0
 
LVL 22

Expert Comment

by:earth man2
ID: 37762262
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question