php - Mulitple sql select or one combined select -
i have multiple language table texts. (columns: hu, en, de, sr, ...) rows contain texts. every text in website stored in table. have lot of select queries in different places.
which better, faster?
lots of select queries 1-1 result
select en langtexts id='41'; select en langtexts id='63'; select en langtexts id='89';
or 1 query texts, stored in array, , use array output texts.
select en langtexts
the table has lot of rows large texts.
you mention that:
the select queries in different places in different files. don't know exact ids before outputting texts. can select texts without ids. useless me.
however, can pass variables between different php scripts storing them in php $_session variable.
i think way achieve want update $_session['guimessages'] results of query.
this variable, vector containing data in respective database column, exist in memory remaining lifetime of user's session.
in scenario, might save some processing time. however, if many users use same language, approach doesn't scale , expect yield worst results. this, since in session increase overhead , decrease performance, due fact "guimessages" variable kept for each user. since sessions in php stored in files default, you'd introducing disk i/o operations.
if problem convenience programmer, why don't define function getguimessages takes care of sqlqueries , receives parameter key , returns array messages? can invoke wherever need without having sql queries spread on place.
Comments
Post a Comment