473,387 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

PHP or PostgreSQL problem?

15
I'm running Sambar 7.0, PHP 5.2 and PostgreSQL 8.2 with WinXP. I built a database that's fed with form data, and created summaries with views and PHP scripts. Pulling a web summary that has a years worth of data comes up in less than 20 seconds. I cloned the database two different ways. One way used pg_dump out of the existing and pg_restore into the new, the other method was to maually execute the SQL to create all the objects. Using the same summary script edited to point to the other database no matter how it was created takes more than 20 minutes to display. Running the queries in pgAdmin gives results in ms, so I'm assuming the problem is a quirk in PHP. I've searched all the logs and can find no errors, warnings or notices. Postgres and PHP documentation indicate there shouldn't be a problem. Ideas?
Mar 7 '08 #1
9 3080
ronverdonk
4,258 Expert 4TB
Welcome to the Scripts!

Show us some of that PHP code you use. And please within appropriate code tags!

Ronald
Mar 10 '08 #2
foneman
15
I really appreciate the quick response! Thanks for the reply, but after finding the statistics portion of PostGreSQL, I've figured out the second database isn't scanning the indexes that were set up. This would explain the fact that the PHP script works, but is extremely slow. Why would PostGres use the indexes in one database, but not the other?
Mar 11 '08 #3
Configuration likely....
I would set up and configure a database with all the configurations users etc set up, then when you need a new one, export, rename (with php even) and import guranteeing that all your settings will be there each and every time.

I am currently setting up a system with postgres where I have a template schema that php will export, parse the exportfile replacing all "schemaTemplate" with the user name giving each user an identical build schema.

Schema's are pretty awesome and they very well be the answer rather than using multiple DB's depending on needs.
Mar 11 '08 #4
foneman
15
So from PHP how do you address each schema if the tables and queries are named the same? The deeper I get into this, the harder it gets. I noticed that someone in another forum created two identical databases in a cluster and can connect to one but not the other. This doesn't bode well with me. Using pgAdmin III to execute the views in both databases, they run comparably, in the ms. Pulling the data through a web server with PHP gives a full page from the first database in 20 seconds or so. Doing so with the second, but identical database takes 20 - 30 minutes. The PHP code is identical with the exception of the database name. The indexes are being hit in the first database but not the second. Configuration settings appear to be global, and so far small changes have yielded some improvement, but have not closed the gap in performance. There's not much documentation that addresses multiple databases in a cluster, and what there is simply indicates they should run comparably. I'm finding no documentation at all of how to configure an individual database in a cluster. I created the second database twice, once by using pg_dump out of the first and pg_restore into the second, so the settings should be the same. The second copy of the databse was created by running the SQL from the first database manually in the second to build each of the items. The performance of both copies is the same.... dismal. Why be able to build two databases if only the first one works correctly? No errors, no log entries.... just horrible performance.
Mar 11 '08 #5
foneman
15
Maybe I should post to the PostGreSQL forum?
Mar 11 '08 #6
This question does belong in the postgres forum, but maybe this will help you get your answer.

Postgres Users have a defualt schema that they query, and by default (I believe) the default schema would be of the same name as the user. therefore if you were to copy the schema replacing the default schema name with the user name, then that user should always query that schema. If the table is not in their schema, then it checks the public schema (if you have one)

Ask in postgres how to set this sort of situation up
Mar 12 '08 #7
ronverdonk
4,258 Expert 4TB
I will move this to the PostgreSQL forum.

moderator
Mar 12 '08 #8
foneman
15
The plot thickens. I created a schema in the original database and duplicated all the tables and views. Imported all the data from the Access database. Performance of the newly created schema is he same as the duplicated databases. This time, however, the performance of the original schema suffered by doubling the pull time. Dropping the schema restored the performance of the original schema. I give up. There's no documentation that helps, and appears no one here knows what the problem is. I'll be uninstalling postgres and going back to Access. At least it works and doesn't require a masters degree to make it work. I've wasted days on this.
Mar 14 '08 #9
foneman
15
I figured it out. It's all about how PHP and Postgres use memory.
Mar 21 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Otis Green | last post by:
Vote for or against a new newsgroup proposal. To summarize what you need to do, just send an empty e-mail to postgresql-ballot@netagw.com You will receive a ballot by e-mail. Follow the...
125
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from...
0
by: Bill J. | last post by:
I have to update a PostgreSQL linked server through MSSQL2K. I first configured the connection with ODBC as follows and I can do queries with no problem: EXEC sp_droplinkedsrvlogin @rmtsrvname...
0
by: Bill J. | last post by:
I have to update a PostgreSQL linked server through MSSQL2K. I first configured the connection with ODBC as follows and I can do queries with no problem: EXEC sp_droplinkedsrvlogin @rmtsrvname...
33
by: Joshua D. Drake | last post by:
Hello, I think the below just about says it all: http://www.commandprompt.com/images/mammoth_versus_dolphin_500.jpg Sincerely, Joshua Drake
20
by: John Wells | last post by:
Yes, I know you've seen the above subject before, so please be gentle with the flamethrowers. I'm preparing to enter a discussion with management at my company regarding going forward as either...
29
by: Paul Ganainm | last post by:
Hi all, Following up on another thread, here is a comparison between FB and PG from an FB'ers POV. BTW, FB is the love-child of Open-Source-Interbase. BTW, I have tried to be as accurate as I...
19
by: Alex Madon | last post by:
Hello, I am testing a web application (using the DBX PHP function to call a Postgresql backend). I have 375Mb RAM on my test home box. I ran ab (apache benchmark) to test the behaviour of the...
6
by: brijesh | last post by:
Sir, I am a development engineer in network application I have a problem regarding upgrading my database the problem is how do I transfer the contents from one table in a database from one server...
2
by: agus liem | last post by:
Hai.. I introduce myself, my name : Agus, from Indonesia. Im develop application using POwerbuilder 7 and postgresql 7.3. I have serveral error, and cannot solve yet. Anybody help me? This is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.