August 11th, 2000, 05:06 PM
Hi I'm writing a weather web site using PHP/MYSQL.
My table has parameters like day, max, min, weather. These parameters will change on a daily basis, BUT I also have parameters like
lat(for latitude) and long (for longitude), plus a few other constants.
So my question is, should I have a separate table called constants to store these values, then call them when needed?
or would it be better to have them all in one table?
August 11th, 2000, 07:09 PM
for what is still a relatively small table. having the constants will not affect performance much.
Querying 2 tables will reduce performance , it doubles the time taken to access the DB which is the slowest part of the equation.
Unless you have hunderds of constants, keep them in a .inc file, and then <? include("constants.inc");?> on any page that nees them.
If you do keep everything in one table , just be frugal with your selects, and pull out only the data you need at any one time.
August 11th, 2000, 07:16 PM
I believe the simplest solution is to choose whatever you are more comfortable with...
As far as performance is concerned, the one-table solution is more efficent. It'll save n processor cycles (n being the # of vars in the current table minus the # of constants -multiplied by some time constant of the processor, and a little extra for the time saved by not passing two seperate sets of data to any functions)
...But how much do we truely need that extra 0.000x seconds when the program's users are downloading at 56.6?
...I see firepages just wrote...I concur with firepages.
[This message has been edited by snoop logy dogg (edited August 11, 2000).]