Forum Moderators: coopster
Most of the tables will be under 50 rows and indexed well. The biggest table will be the main content table which itself shouldn't be more then 200 rows. So as i also don't expect there to be a massive user base as well should this be ok, using 8 calls per page.
Is there somewhere i can go to see load statistics ie how many calls per page is good for what size a site is etc...
Or can someone give me an idea of if what i'm doing would be ok or not
Thanks
Trent
Best practice would say that you should make as few calls to the database as necessary, as each call could potentially slow down your script. (Imagine the scenario where you have lots of visitors, and some of your DB calls are database updates. The tables would be locked whilst the update takes place, and this would slow down your script execution / page rendering).
As, however, you say you have only 200 rows, and a small user base, performance shouldn't be hit that bad.
You can get an idea of performance by timing your scripts.
Google for "php execution time" for some ideas.
Time your current code, modify it, and test again.
HTH,
JP
You can also cut down on queries by doubling up info in some tables (against strict db normalization, but the mysql folks encourage this for web apps) as long as your admin logic takes account of this and is water-tight - can save you a tiny bit of speed. Once you're already getting info from a db row, just getting a few more fields of info is trivial. But what's even better is if you can get your system to use some kind of naming convention. Then, if there's a chapter called 'lonely goldfish', you always have this use lonely_goldfish.gif, etc, and when your user uploads the gif, you just rename it on the spot. Some kind of 1 to 1 correspondance between the info you already have, and the info that needs to be 'attached.'
I didn't realise mysql recommend this in some cases, i'm going to go with my 8 calls at this point and see how it goes then look into some changes once she's up but am just personally against doubling content (as we all are) but I also think it shall be a good learning experiance to see how she runs and then make changes if I need
at this point my page is loading in between 0.00239491462708 and 0.00870299339294 seconds (not sure how that compares?), granted it's very lack of content and not too many hits on a dev server ;) but it's great to get this feedback
Thanks
Trent
for($i = 0; $i < 50; $i++){ }
[be2.php.net...]
I think this will give an idea or how long to call the page 50 times or so...
Any other ideas would be appreciated as this is just something i have thought of but have never done testing like this before!
Trent
I do find that strict normalization is not always the best route. Storing a little more in a table sometimes pays off in less complicated queries. I did feel kinda guilty about this till I read this post!