Ask a Question related to PHP Development, Design and Development.
-
John W. Holmes #1
Re: [PHP] config tests
Uros Gruber wrote:
Question: How many people selected 'blue' for their config color?> Hello!
>
> I just made some speed tests getting configuration from DB.
>
> For now I figured 2 ways doing this.
>
> 1. One value in each row
>
> id | name | val
> ----------------------
> 1 | name1 | value1
> ........
>
> 2. using serialize($config) and saving this in one row.
> $config is predefined array of configuration.
>
>
> I test this with 100 config values. First I read all 100 rows for 1st
> example, then I read only one row and then unserialize this to get
> array.
>
> Here is result:
>
> 1st example 0.0478450059891 86.74%
> 2nd example 0.0073139667511 13.26%
>
> There you can see speed of second example. I wan't to know what do you
> think about this. And what's your solutions of reading config from DB.
> I saw that many big project still use first example.
>
1. SELECT COUNT(*) FROM Table WHERE config_color = 'blue';
2. ?? SELECT COUNT(*) FROM Table WHERE serialized_column LIKE
'"config_color";s:4:"blue";'
Basically, method 1 is more flexible. With method 2, you'll need to
store it in a TEXT column or hope your serialized value never goes over
255 characters.
--
---John Holmes...
Amazon Wishlist: [url]www.amazon.com/o/registry/3BEXC84AB3A5E/[/url]
PHP|Architect: A magazine for PHP Professionals – [url]www.phparch.com[/url]
John W. Holmes Guest
-
Error loading XML file c:\windows\microsoft.net\framework\v1.0.3705\Config\machine.config
I had many ASP.NET web applications that I created before I had to rebuild my machine. After a fresh install of XP Pro, VS.NET 2003, etc, I now... -
Web References how to config to read URL from config?
It's great that VS.NET makes it so effortless to add a web reference to a web service. The problem is, I haven't figured out a way to configure the... -
config file: a) what Module ? b) conditionals in config (for multiple hosts)
Hi, a) I am looking for a module to handle config files. There are a number of these modules, like AppCconig. Any consensus about The Right... -
[RCR] Include CONFIG::Config['rubydocdir'] in rbconfig.rb
Hi folks, I apologise if people have read this RCR and are not interested, but this is what I consider to be an important RCR, not a merely... -
config tests
Hello! I just made some speed tests getting configuration from DB. For now I figured 2 ways doing this. 1. One value in each row id | ...



Reply With Quote

