Re: Advice about optomizing MYSQL



IchBin wrote:
J.O. Aho wrote:
ZeldorBlat wrote:
maxdamage wrote:
Well, I was wondering if it would be better to do a series of smaller
queries (about 5 - 10) and use less overhead on the PHP end or do one
big querry that would fill a huge array (maybe 50x10) and use a ton of
overhead.

One big query. Trips to the database are generally expensive and a 50
x 10 array isn't very big at all. If all else fails, try the two and
see which performs better.

Keep in mind the distance to the mysql server from the machine running the php script. The further away the more risk for lag.

Figured I would touch on this. Is there any question about the performance of queries or this just the php end? If so how about normalizing the database? Every little bit would help.

Selecting the right normalization is of course important, just having one table or split everything in as small tables (column vise) are bad options, you need to find what will be most common asked data and try to have as few joins as possible to get the data out from the database.
There are quite many books written in this subject, a search on google gave those while web pages about it may come further down on the list.

One way that you can do is to normalize it as much as possible, then look at data that you need often and un-normalize until you got tables with data that you retrieve together and you should get an okey working database structure.
Another method that some recommend is to normalize 2-3 times and then halt.
I guess there are quite many different schools here, it's a question what feels easiest for you.


//Aho
.



Relevant Pages

  • Re: pause processing
    ... I'd like to give the user an opportunity to examine the print_rof that array before continuing. ... I suppose I could declare $what as a global variable and have the form invoke another php script that processes it, but strongly suspect that there're better ways of doing it. ... When the user submits the form, store the data in the database. ... If the data's not too big, you can store it in the $_SESSION array. ...
    (comp.lang.php)
  • pause processing
    ... A php script processes some form inputs to produce an array of data for ... further processing before insertion into a database table. ... give the user an opportunity to examine the print_rof that array ... The idea I had in the php script was something like: ...
    (comp.lang.php)
  • Re: KirbyBase
    ... creating objects from the database records was much easier. ... Hal, I don't know if you have had a chance to take a look at the beta yet, but I basically tried to implement a uniform way to specify one-to-one links, one-to-many links, and calculated fields in the ... I suppose it would in effect be embedding an array where all the ... My first couple of attempts at adding more complexity to KirbyBase did not honor this concept. ...
    (comp.lang.ruby)
  • Re: KirbyBase
    ... I'm an Object Guy and Jamey is a Database Guy. ... That requires the table name and key field name to be specified ... I suppose it would in effect be embedding an array where all the ... that is) might compress by a factor of 10 or more. ...
    (comp.lang.ruby)
  • Re: using BLOB objects and ...
    ... while saving the array object to the database which is ok but while ... convert it back to object of 4 dimention boolean array which will be ... will let you store your 4 dimensional boolean array in it. ... You may have to modify my suggestion ...
    (comp.lang.java.programmer)