PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > Speeding up Hierarchical Data quering
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Speeding up Hierarchical Data quering

Réponse
 
LinkBack Outils de la discussion
Vieux 06/02/2008, 11h25   #1
pieter.thoma@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Speeding up Hierarchical Data quering

Hi,

I have a table with hierarchical data, which is stored using the
Modified Preorder Tree Traversal algorithm (MPTT).

More information about MPTT can be found here:
http://dev.mysql.com/tech-resources/...ical-data.html.

I was wondering if indexing on the lft and rgt column will have speed
advantages, as the cardinality of the index will always be the same as
the number of rows there are in the database.

In my case, there are about 40000 rows in my hierarchical data table.
  Réponse avec citation
Vieux 06/02/2008, 11h31   #2
Rik Wasmus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Speeding up Hierarchical Data quering

On Wed, 06 Feb 2008 12:25:55 +0100, <pieter.thoma@gmail.com> wrote:

> Hi,
>
> I have a table with hierarchical data, which is stored using the
> Modified Preorder Tree Traversal algorithm (MPTT).
>
> More information about MPTT can be found here:
> http://dev.mysql.com/tech-resources/...ical-data.html.
>
> I was wondering if indexing on the lft and rgt column will have speed
> advantages, as the cardinality of the index will always be the same as
> the number of rows there are in the database.


It will have advantages in selecting, it will make
inserting/altering/deleting slower.
--
Rik Wasmus
  Réponse avec citation
Vieux 06/02/2008, 11h42   #3
Rik Wasmus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Speeding up Hierarchical Data quering

On Wed, 06 Feb 2008 12:31:30 +0100, Rik Wasmus
<luiheidsgoeroe@hotmail.com> wrote:

> On Wed, 06 Feb 2008 12:25:55 +0100, <pieter.thoma@gmail.com> wrote:
>
>> Hi,
>>
>> I have a table with hierarchical data, which is stored using the
>> Modified Preorder Tree Traversal algorithm (MPTT).
>>
>> More information about MPTT can be found here:
>> http://dev.mysql.com/tech-resources/...ical-data.html.
>>
>> I was wondering if indexing on the lft and rgt column will have speed
>> advantages, as the cardinality of the index will always be the same as
>> the number of rows there are in the database.

>
> It will have advantages in selecting, it will make
> inserting/altering/deleting slower.


BTW, one way to speed up inserting/deleting/updating, is to leave quite
huge gaps between lft & rgt values. This way, on almost all record
changes, no altering of other records (save for possible descendants) is
required (yet). This speeds up things a lot, but requires quite some
carefull code checking for gaps & need, and possibly a scheduled
'reindexing' at some regular interval.
--
Rik Wasmus
  Réponse avec citation
Vieux 06/02/2008, 11h49   #4
pieter.thoma@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Speeding up Hierarchical Data quering

On Feb 6, 12:42 pm, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Wed, 06 Feb 2008 12:31:30 +0100, Rik Wasmus
>
>
>
> <luiheidsgoe...@hotmail.com> wrote:
> > On Wed, 06 Feb 2008 12:25:55 +0100, <pieter.th...@gmail.com> wrote:

>
> >> Hi,

>
> >> I have a table with hierarchical data, which is stored using the
> >> Modified Preorder Tree Traversal algorithm (MPTT).

>
> >> More information about MPTT can be found here:
> >>http://dev.mysql.com/tech-resources/...ical-data.html.

>
> >> I was wondering if indexing on the lft and rgt column will have speed
> >> advantages, as the cardinality of the index will always be the same as
> >> the number of rows there are in the database.

>
> > It will have advantages in selecting, it will make
> > inserting/altering/deleting slower.

>
> BTW, one way to speed up inserting/deleting/updating, is to leave quite
> huge gaps between lft & rgt values. This way, on almost all record
> changes, no altering of other records (save for possible descendants) is
> required (yet). This speeds up things a lot, but requires quite some
> carefull code checking for gaps & need, and possibly a scheduled
> 'reindexing' at some regular interval.
> --
> Rik Wasmus


Yes it will. Luckily in my case, the data is static. It's a write
once, read many.

But inserting is slow indeed.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 19h13.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12623 seconds with 12 queries