If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Postgress SQL

So I know almost nothing about SQL and I came across a project a work. I was originally going to set up an ODBC connection from a server running my company's software to a Postgress server. Unfortunately, we have had quite a few setbacks. We wrote a php script to help us export the data that we needed from the Postgress database, and it worked the way it was supposed to. The only problem was that it takes 45 minutes for a query to run. That seems a little over the top, so we did some research and it appears that the driver we have for the database(newest one we could find), takes the entire table that we are querying and pulls it across the network to the machine that initiates the query and runs the query then. I have had a few ideas and thought maybe someone could help me fine tune them. Is it possible to run the query on the Postgress server and automate it? How about a batch file? I know that it's a little archaic, but I'm getting desperate!!!!. The query taking 45 minutes wouldn't be such a big deal, except that the data is kind of time sensitive. My company has notification software for schools and the query is for period attendance. I will be happy to supply any information requested, as long as it doesn't break my "close your mouth" contract. HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1

Sounds like you might have some problems in your php code. There are always two ways to do things. One would be to bring the data accross, and manipulate it in php. The other is to manipulate it via a query on the SQL server and just bring back the required data. I would venture to guess you are doing the first.

You might suggest a code review of sorts to find out if the code is using the SQL server efficiently.

Per Sir Dice's request the driver is MERANT 3.6 32-BIT Progress SQL92v9.1D. That is how the driver is listed in the system DSN tab. Here is the code, this is just a test bc we still need to get a preffered connection before we decide the exact query.

I left out the server information for obvious reasons. I would like to stress that I am anything but proficient with php and am in the process of trying to learn it. I didn't write this code, another guy from my company did, but am working with it to see about making it successful. Is there a way to automate the query on the machine? The user says that they have a nice query that runs quickly on the machine, but that there is no way to automate it bc you have to open the tool and run the query even though it is saved in a format similar to a data view.