RE: [PHP] database connections
| From: | Ryan A | Date: | Mon, 24 Jul 2006 19:43:06 +0000 |
| Subject: | RE: [PHP] database connections | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-239739@lists.php.net to get a copy of this message | ||
--- "Kilbride, James P." <James.Kilbride@gd-ais.com>
wrote:
> While that kind of query structure can be a huge
> issue the biggest
> problem, and performance penalty, occurs if the
> programmer is opening
> and closing actual real connections. A good
> structure would use a
> singleton connection that is opened only the first
> time it is called and
> the rest of the time returns the connection object
> already opened. Or,
> use pooling or similar types of things. You will get
> orders of magnitude
> increase in speed by not reopening the database
> multiple times per page
> especially if you are seeing 15,20 or especially
> hundreds of
> connections. Sometimes though you have no real
> choice but to build a
> system that has to generate multiple queries, so
> don't judge the page
> simply on the number of queries but on the
> completity of the reporting
> and the number of database connections opened(you
> will occasionally need
> more than one if you arn't pulling all the results
> at once, using
> cursors or partial retrievals instead and have to
> have multiple result
> sets open at any given time).
>
> James Kilbride
Hey James,
Thanks for replying.
Sorry, I guess i was not clear on that.
Its just one connection, I meant 15-20 queries not
connections.
Thanks!
Ryan
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com