Skip site navigation (1) Skip section navigation (2)

Re: DESIGN CONCEPT (performance) - switch/arrays/forms

From: brew(at)theMode(dot)com
To: pgsql-php(at)postgresql(dot)org
Subject: Re: DESIGN CONCEPT (performance) - switch/arrays/forms
Date: 2003-05-31 03:36:44
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-php

> My idea is to have a category table with references to the forms on disk
> so i can fetch it into an array; search the array to find the
> corresponding form for the category id, and include that form;

I think this is something like I'm doing on my musician's classified, on some pages.

I have a few master table of contents pages that show the number of
listings in each telephone area code.  On my laptop it ran in less than a
second, but on my shared web host it took several seconds. I think there
are about 80 accounts on the machine, and EACH one runs it's own copy of
Apache and the accounts that have DB servers EACH have their own copies,
too, be they mySQL or postgreSQL, or whatever.  Nice concept, but it bogs
down with processes when something goes wrong in an account.

At any rate, what I did to speed it up was run a cron job once every few
hours to assemble the Table of Contents pages and store them as one record
in the postgreSQL database, using php to pull it out.  It's faster that
way, but still takes about 100 milliseconds on the online shared machine,
on my laptop it takes 20 milliseconds.

On the shared machine when processes start running away the static pages
still serve fairly quickly but the DB stored pages get noticibly slower.
When I find my Round Tuit I'll make more and more of the cron assembled
pages store on the file system instead of the database.  Of course for
interactive DB searches I'll still use the DB server.  Or maybe I'll work
out a way to get a dedicated machine on a fast pipe eventually.

So I guess it's hard to predict as it depends on the server load.  My
website only gets a few page views a minute, I would be afraid to try to
serve multiple page views a second on a shared machine like this, but I
bet a dedicated machine could do it and probably many on the list have
dedicated machines.

BTW, for the record I use for my webhost.

> if this concept could work fine, could anyone give me an example on how
> to do this?  i am just learning PHP.  thanks a lot.

If you search around the web you'll find examples of using php and
postgreSQL together, start reading and coding and reading and coding.

Maybe someone can recommend a book, I can't because when I started with
Relational Databases it was with perl and mSQL (that's mini SQL, not
mySQL), I transposed to php a few years later.  I use postgreSQL for, even though mySQL could do everything I'm doing now. I want
to get more familiar with transactions, functions and triggers eventually
for other projects so I went with PostgreSQL for the experience.

The other thing that helps is having a machine to play on.  I have perl,
php, mySQL and postgreSQL all on my Debian linux laptop (and all running
at once).


                  Strange Brew   (brew(at)theMode(dot)com)
     Check out my Musician's Online Database Exchange (The MODE Pages)

In response to

pgsql-php by date

Next:From: Andrew J. KopciuchDate: 2003-05-31 04:58:48
Subject: Re: DESIGN CONCEPT (performance) - switch/arrays/forms
Previous:From: Bruce YoungDate: 2003-05-30 23:41:43
Subject: DESIGN CONCEPT (performance) - switch/arrays/forms

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group