Re: great problem with questions

2004-09-24 Thread Roger Baklund
* DeRyl > * Roger Baklund > The first thing to notice: "Using temporary"... this is to be avoided, if > possible. > > ## how is the correct way to avoid that? Depends, in this case I think it is because of the DISTINCT. > The first table read is klientslowo based on the criteria > klientslowo.kli

Re: great problem with questions

2004-09-23 Thread SGreen
"DeRyl" <[EMAIL PROTECTED]> wrote on 09/23/2004 09:51:45 AM: > The fact that you are joining 10 tables together in one query may be a > major portion of your performance problem. Even if the *average* size of > each table is only 10 rows, the MySQL engine will have to pour over > 10x10x10x10x10x10

Re: great problem with questions

2004-09-23 Thread SGreen
The fact that you are joining 10 tables together in one query may be a major portion of your performance problem. Even if the *average* size of each table is only 10 rows, the MySQL engine will have to pour over 10x10x10x10x10x10x10x10x10x10 = 10 to the 10th power = 1e10 = 10,000,000,000 (10 b

Re: great problem with questions

2004-09-23 Thread DeRyl
The first thing to notice: "Using temporary"... this is to be avoided, if possible. ## how is the correct way to avoid that? The first table read is klientslowo based on the criteria klientslowo.klientslowo LIKE 'sam%'. Is this a reasonable approach to solving the query, giving your knowledge of

Re: great problem with questions

2004-09-23 Thread Roger Baklund
* DeRyl > explain example sql question gives: [...] The first thing to notice: "Using temporary"... this is to be avoided, if possible. The first table read is klientslowo based on the criteria klientslowo.klientslowo LIKE 'sam%'. Is this a reasonable approach to solving the query, giving your kn

Re: great problem with questions

2004-09-23 Thread Stefan Kuhn
Am Thursday 23 September 2004 13:22 schrieb Stefan Kuhn: > This is probably due to having indexed only single columns. MySQL uses only > one index per column, meaning if you have a where with two conditions you Sorry, this should read "one index per table"... > need a combined index for the colum

Re: great problem with questions

2004-09-23 Thread DeRyl
entulicaid` int(11) default NULL, KEY `klientulicaid` (`klientulicaid`), KEY `klientid` (`klientid`) ) TYPE=MyISAM; --- Darek - Original Message - From: "Roger Baklund" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: "DeRyl" <[EMAIL PROTECTED]> Sen

Re: great problem with questions

2004-09-23 Thread Stefan Kuhn
This is probably due to having indexed only single columns. MySQL uses only one index per column, meaning if you have a where with two conditions you need a combined index for the columns used. If there are only indeces for the single columns, only one index for one condition will be used, the r

Re: great problem with questions

2004-09-23 Thread Roger Baklund
* DeRyl > I have database with 30 tables [some have over 2000k some other > over 4000k rec] > > when I want to run a sql with a few conditions the answer is > dramatically slow > [over 70 seconds!] > sql-s with one condition usually works well.. > > how is the corrcet way to optimize the database