Re: Static Array vs MySQL query
| From: | Eric | Date: | Fri, 28 Nov 2003 23:34:34 +0000 |
| Subject: | Re: Static Array vs MySQL query | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171307@lists.php.net to get a copy of this message | ||
"John Nichel" <jnichel@by-tor.com> wrote in message
news:3FC7D5DE.3040103@by-tor.com...
> Hi,
>
> I'm designing my site to use drop down menus, and am having php
> generate the content of the main manus, as well as the sub-menus. What
> I'm wondering is what the performance hit will be with putting all the
> menu variables into an array in a config file vs storing the info in a
> MySQL table, and retriving the data from there. The main menu data is
> currently in a config file, and takes up 1.4kb, so I can only assume
> that with how many sub-menus that to config it all in a static array,
> the filesize is going to be well over 20kb. The data would have to be
> read into memory from both the static file, or from the db, so which do
> you think would be the fastest and/or least memory intensive? Thanks
> for any suggestions.
>
> --
> By-Tor.com
> It's all about the Rush
> http://www.by-tor.com
Hi John
A common solution I once found for saving database operation time, was to
store information from the db in some kind of file.
You could for example have a database with all the data, but you run a
special script when there is any updates that updates a include file with
the data.
Under the generation process, you can simply make a script to get the data,
and dynamically make a php file that will be stored.
Eric