Re: database connections
| From: | Richard Lynch | Date: | Fri, 04 Aug 2006 21:52:37 +0000 |
| Subject: | Re: database connections | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-240170@lists.php.net to get a copy of this message | ||
On Mon, July 24, 2006 1:33 pm, Ryan A wrote:
> Hey Rob,
> Thanks for replying.
>
>
>> It's usually a sign of poor programming and/or
>> purist OOP programming.
>>
>> When I say purist OOP programming...
>> I saw
>> one really retarded
>> implementation of this kind of system where an
>> excess of 20000 queries
>> were issued to the database -- on a homepage
>> nonetheless :/
>
>
> That IS retarded, I wonder why someone would want to
> do that.
Because they learned from Java which has an entirely different
architecture with a shared cached DB store across the application
servers, wherein such a technique makes a whole hell of a lot more
sense.
And because they don't REALLY understand the power of OOP, and are too
literal-minded when architecting class inheritence -- But that
describes about 99% of the so-called OOP developers "out there" so
there ya go.
> I was curious about this because I am working on a
> project (with other team players) and we have a way of
> building something with either lots more (complicated)
> code and fewer database calls or less code and
> multiple tables.
>
> If we take the second option (multiple tables) I am
> talking about maybe 15 database calls per page, and
> the site will get around (i guess) 300-750 requests
> for a page a minute at is peak.
Measure it and see.
I've seen times when 15 DB calls was a hell of a lot cheaper than 1 DB
call, depending on the indexes in the DB and the query and...
There's just no way to predict this without a detailed analysis of the
DB schema and the queries and the hardware and...
It's almost-for-sure faster for you to write 2 prototype examples with
realistic-sized data and throw Apache benchmark at them to find out
your answer.
> I wouldnt be going to those extremes, was thinking of
> around 5-15 queries per page.
15 queries per page, with a good schema and reasonable queries is
chump-change.
15 bad queries on a page will kill you before you even launch. :-)
--
Like Music?
http://l-i-e.com/artists.htm