Re: self-joins in hierarchical queries: optimization problem

2009-10-30 Thread Olga Lyashevska
Dear Michail and Sergey, Thank you very much for your responses and kind suggestions! On 29.10.2009, at 16:53, Sergey Petrunya wrote: this makes it clear that index on O1.tsn will not be useful. You need indexes on parent_tsn column. mysql> alter table taxonomic_units1 add index (parent_t

Re: self-joins in hierarchical queries: optimization problem

2009-10-29 Thread Mikhail Berman
Olga, Would you post "SHOW CREATE TABLE taxonomic_units1\G;"? It should give us more info on the table you are dealing with Regards, Mikhail Berman Olga Lyashevska wrote: Dear all, I have a table which contains taxonomic data (species, genera, family, order, class) and it is organized as a

Re: self-joins in hierarchical queries: optimization problem

2009-10-29 Thread Sergey Petrunya
On Thu, Oct 29, 2009 at 07:53:25PM +0300, Sergey Petrunya wrote: > ... taxonomic_units1 AS O1 > LEFT OUTER JOIN taxonomic_units1 AS O2 > ON O1.tsn = O2.parent_tsn > > current optimizer has only one option(*): use Nested-Loops Join algorthm, with > the outer table being the first one. That is,

Re: self-joins in hierarchical queries: optimization problem

2009-10-29 Thread Sergey Petrunya
Hi Olga, On Thu, Oct 29, 2009 at 03:29:58PM +, Olga Lyashevska wrote: > I have a table which contains taxonomic data (species, genera, family, > order, class) and it is organized as adjacency list model. > > mysql> select* from taxonomic_units1 limit 5; > +-+-

Re: self-joins in hierarchical queries: optimization problem

2009-10-29 Thread Olga Lyashevska
Thanks Kabel, Not sure if this is the exact problem you're trying to solve, but this helped me in a similar situation. http://dev.mysql.com/tech-resources/articles/hierarchical-data.html Yes, I have seen this article before, and it is really nice. However they do not discuss any optimizat

Re: self-joins in hierarchical queries: optimization problem

2009-10-29 Thread kabel
Not sure if this is the exact problem you're trying to solve, but this helped me in a similar situation. http://dev.mysql.com/tech-resources/articles/hierarchical-data.html kabel -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysq

self-joins in hierarchical queries: optimization problem

2009-10-29 Thread Olga Lyashevska
Dear all, I have a table which contains taxonomic data (species, genera, family, order, class) and it is organized as adjacency list model. mysql> select* from taxonomic_units1 limit 5; +-+---+-+ | tsn | name | paren