Solved

stored procedures in postgre || how to script and where

Posted on 2012-03-23
2
971 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
Comment Utility
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
Comment Utility
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
The viewer will learn how to count occurrences of each item in an array.

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now