Re: Using Materialized Path to create a paths table

From: Mikito Harakiri <mikharakiri_nospaum_at_yahoo.com>
Date: 26 May 2006 09:06:29 -0700
Message-ID: <1148659589.349160.245230_at_g10g2000cwb.googlegroups.com>


Matthew Brealey wrote:
> To find the ancestors however with the following query
>
> select
> Ancestor.EmployeeId
> from Employee as Descendant
> inner join Employee as Ancestor on Descendant.MaterializedPath like
> Ancestor.MaterializedPath + '%'
> where Descendant.EmployeeId = 4
>
> requires a table scan.

Why not to calculate ancestors encoding (on client or with stored procedure), put them in temporary table, and extract all the ancestors with simple join? Received on Fri May 26 2006 - 18:06:29 CEST

Original text of this message