> > I would emagine that only one 'left join' takes less processing power? > > Yes, but I don't think there is very much extra processing time involved > using one more join in most cases, as long as the join is indexed and the > index blocks involved are cached, or if the amount of data is reasonable > small... you are not translating the entire language, only a few words, > right?
Yep, only a few words and sentences :) And you are rigth, there isn't much difference between the two queries. Only about 15-20%. > If the size of _all_ used indexes on the server (combined index field widths > multiplied by number of records for all tables in all databases!) is very > big compared to the available memory on the server (key_buffer_size), the > mysql key buffer will more often miss the needed keys, and the server will > need to read from disk. When there are large amounts af data involved > (multiple GB) and many joins (10-15), I have experienced a high processing > time the first time I execute a query (like 30 seconds), and when the same > statement is repeated I get an execution time of less than a second (version > 3.23, MyIsam). All the joins use indexes. I suppose in such a case (too > small key_buffer_size and very big index) one less join could be helpfull. Well, thankfully that isn't my case :) > > One thing that I have been wondering about, is if such a query > > like this, is too power-hungry if it has to be run every time you > > do anything on a homepage. > > That depends... what is your experience? None :) > Do you need to read _all_ textkeys for each page? How many different > textkeys do you have in the table? No I don't have to read all the textkeys at once. They are usually selected via a join from another table. And sometimes I will read a set of rows via a sectionid. Right now, I don't have many textkeys... but the number will increase quite a bit! I would imagine around up to 500 rows per language max. And I think that 2-3 languages will be usual. > > One possibility is to cache the result in a session. > > Yes... if you need to do the same query for every click, and this query > could possibly be time consuming, you should probably reconsider. Different > languages on a web site could for instance be implemented by using multiple > template files: somepage_da.php, somepage_en.php and so on, combined with > joining from the language tables when listing information from the database. > The different php-files could be produced by a script, using the same > language tables and a single, language neutral template... This is just a > suggestion, there are many ways to do this. :) Yes, but now as I have seen how quick this query is, then I don't think I have much to worry about :) I just made a little 'Query Tester' script in PHP, where I can see how much time is spent before the mysql_query() function is done. I really like my little program. It's much easier to test queries, than i fx. PhpMyAdmin. Don't know if you program in PHP and use PhpMyAdmin, but I had some errors, when running a query where I use aliases on tables and when I have a fieldtype of text or blob. Oh, so you are from Norway! My sister lives in Norway too... Vikersund not far away from Drammen :) Ha' det godt og tak for hjælpen - so far :O) /Stig --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php