Re: object persistence within a session
| From: | ceo at l-i-e dot com | Date: | Mon, 10 Nov 2008 14:29:33 +0000 |
| Subject: | Re: object persistence within a session | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-283177@lists.php.net to get a copy of this message | ||
> Perhaps, but the examples I usually find when cleaning up code are of
> the variety where a script executes one statement to find a list of
> parent records, iterates through those records and inside the loop it
> executes another statement (sometimes multiple statements!) to get the
> details, update records, etc.
That's usually bad...
But that doesn't mean that ONE more DB query will kill you.
And there are times when the JOINs for the one-query solution will kill you anyway, but with proper
pagination, the dozen multi-query solution will zip along merrily.
What is "good" for the DB storage and what users end up wanting collated on a page are
occasionally at odds, especially for the admin pages.
If you've tweaked the front-facing user side and correctly laid-out the DB for maximum
scalability for the users, the admin side can sometimes be a bit hairy like that...
Which is fine, since the admin side is much less trafficked.
Short Version:
Sometimes you should break the rules. Knowing when is called "experience"