Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-29-2008, 08:27 PM
=?ISO-8859-1?Q?Bruno_B_B_Magalh=E3es?=
 
Posts: n/a
Default Practical hierarchies

Hi everybody,

I would like to discuss there hierarchical storage theory. Currently I
have came across 2 types for storing hierarchical data (yes, I´ve read
the article at mysql.com, and MANY others sites), but I would like to
know your option about the day-to-day usage... I mean I´ve only used
hierarchy for some small to medium projects, but I now I am planning a
big account project (yes, I´ve researched many open-source solutions,
but none was suitable for an enterprise level solution), and if
someone has already walked this path... Well, I would like to share
and discuss... How Oracle, SAP and Microsoft Dynamics did? Some one
has some insight? ow they manage to store UNSPSC taxonomy data on
their systems?

Here is a table using parent and child relationship:

CREATE TABLE `CatalogsCategories` (
`CustomerID` int(8) unsigned NOT NULL default '0',
`CatalogID` int(8) unsigned NOT NULL default '0',
`CatalogCategoryParentID` int(8) unsigned NOT NULL default '0',
`CatalogCategoryID` int(8) unsigned NOT NULL default '0',
`CatalogCategoryCode` varchar(20) NOT NULL default '',
`CatalogCategoryName` varchar(200) NOT NULL default '',
`CatalogCategoryDescription` text character set latin1 NOT NULL,
`CatalogCategoryActive` int(1) unsigned NOT NULL default '0',
`CatalogCategoryCreatedBy` int(8) unsigned NOT NULL default '0',
`CatalogCategoryCreatedOn` int(20) unsigned NOT NULL default '0',
`CatalogCategoryModifiedBy` int(8) unsigned NOT NULL default '0',
`CatalogCategoryModifiedOn` int(20) unsigned NOT NULL default '0',
`CatalogCategoryRemovedBy` int(8) unsigned NOT NULL default '0',
`CatalogCategoryRemovedOn` int(20) unsigned NOT NULL default '0',
KEY `CatalogsCategoriesIndexA`
(`CustomerID`,`CatalogID`,`CatalogCategoryParentID
`,`CatalogCategoryID`,`CatalogCategoryActive`),
KEY `CatalogsCategoriesIndexB`
(`
CatalogCategoryCreatedBy
`,`CatalogCategoryModifiedBy`,`CatalogCategoryRemo vedBy`),
KEY `CatalogsCategoriesIndexC`
(`
CatalogCategoryCreatedOn
`,`CatalogCategoryModifiedOn`,`CatalogCategoryRemo vedOn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

Pros: Easy to understand and implement the operating clas es, not
export / inport friendly
Cons: Recursive behavior, not suited for reports generation because of
the recursivity


Here is a table using transverse relationship:

CREATE TABLE `CatalogsCategories` (
`CustomerID` int(8) unsigned NOT NULL default '0',
`CatalogID` int(8) unsigned NOT NULL default '0',
`CatalogCategoryID` int(8) unsigned NOT NULL default '0',
`CatalogCategoryLeftPosition` int(8) unsigned NOT NULL default '0',
`CatalogCategoryRightPosition` int(8) unsigned NOT NULL default '0',
`CatalogCategoryCode` varchar(20) NOT NULL default '',
`CatalogCategoryName` varchar(200) NOT NULL default '',
`CatalogCategoryDescription` text character set latin1 NOT NULL,
`CatalogCategoryActive` int(1) unsigned NOT NULL default '0',
`CatalogCategoryCreatedBy` int(8) unsigned NOT NULL default '0',
`CatalogCategoryCreatedOn` int(20) unsigned NOT NULL default '0',
`CatalogCategoryModifiedBy` int(8) unsigned NOT NULL default '0',
`CatalogCategoryModifiedOn` int(20) unsigned NOT NULL default '0',
`CatalogCategoryRemovedBy` int(8) unsigned NOT NULL default '0',
`CatalogCategoryRemovedOn` int(20) unsigned NOT NULL default '0',
KEY `CatalogsCategoriesIndexA`
(`CustomerID`,`CatalogID`,`CatalogCategoryID`,`Cat alogCategoryActive`),
KEY `CatalogsCategoriesIndexB`
(`CatalogCategoryLeftPosition`,`CatalogCategoryRig htPosition`),
KEY `CatalogsCategoriesIndexC`
(`
CatalogCategoryCreatedBy
`,`CatalogCategoryModifiedBy`,`CatalogCategoryRemo vedBy`),
KEY `CatalogsCategoriesIndexD`
(`
CatalogCategoryCreatedOn
`,`CatalogCategoryModifiedOn`,`CatalogCategoryRemo vedOn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

Pros: SQL friendly so much less processing and queries required, not
export / inport friendly
Coms: Not that easy to understand or implement the operating classes

Here is a table using UNSPSC like relationship:

CREATE TABLE `CatalogsCategories` (
`CustomerID` int(8) unsigned NOT NULL default '0',
`CatalogID` int(8) unsigned NOT NULL default '0',
`CatalogCategoryID` int(8) unsigned NOT NULL default '0',
`CatalogCategoryLevel1` int(8) unsigned NOT NULL default '0',
`CatalogCategoryLevel2` int(8) unsigned NOT NULL default '0',
`CatalogCategoryLevel3` int(8) unsigned NOT NULL default '0',
`CatalogCategoryLevel4` int(8) unsigned NOT NULL default '0',
`CatalogCategoryCode` varchar(20) NOT NULL default '',
`CatalogCategoryName` varchar(200) NOT NULL default '',
`CatalogCategoryDescription` text character set latin1 NOT NULL,
`CatalogCategoryActive` int(1) unsigned NOT NULL default '0',
`CatalogCategoryCreatedBy` int(8) unsigned NOT NULL default '0',
`CatalogCategoryCreatedOn` int(20) unsigned NOT NULL default '0',
`CatalogCategoryModifiedBy` int(8) unsigned NOT NULL default '0',
`CatalogCategoryModifiedOn` int(20) unsigned NOT NULL default '0',
`CatalogCategoryRemovedBy` int(8) unsigned NOT NULL default '0',
`CatalogCategoryRemovedOn` int(20) unsigned NOT NULL default '0',
KEY `CatalogsCategoriesIndexA`
(`CustomerID`,`CatalogID`,`CatalogCategoryID`,`Cat alogCategoryActive`),
KEY `CatalogsCategoriesIndexB`
(`
CatalogCategoryLevel1
`
,`
CatalogCategoryLevel2`,`CatalogCategoryLevel3`,`Ca talogCategoryLevel4`),
KEY `CatalogsCategoriesIndexC`
(`
CatalogCategoryCreatedBy
`,`CatalogCategoryModifiedBy`,`CatalogCategoryRemo vedBy`),
KEY `CatalogsCategoriesIndexD`
(`
CatalogCategoryCreatedOn
`,`CatalogCategoryModifiedOn`,`CatalogCategoryRemo vedOn`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

Pros: SQL friendly so much less processing and queries required, very
export / inport friendly
Cons: Fixed deep and a little bit more difficult to implement the
operating classes than parent/child relationships

I would like very much to hear your opinions!

Best regards to you all,
Bruno B. B. Magalhães

BLACKBEAN CONSULTORIA
Rua Real Grandeza 193/210, Botafogo
Rio de Janeiro, RJ, 22281-035, Brasil

+55 (21) 9996-1093
+55 (21) 2266-0597
www.blackbean.com.br

Esta mensagem pode conter informação confidencial e/ou privilegiada.
Se você não for o destinatário ou a pessoa autorizada a receber esta
mensagem, não pode usar, copiar ou divulgar as informações nela
contidas ou tomar qualquer ação baseada nessas informações. Se você
recebeu esta mensagem por engano, por favor avise imediatamente o
remetente, respondendo o e-mail e em seguida apague-o. Agradecemos sua
cooperação.

This message may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose or take any action based
on this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-29-2008, 08:27 PM
Baron Schwartz
 
Posts: n/a
Default Re: Practical hierarchies

Bruno,

Interesting emails. You might consider talking to Arjen Lentz about
his special hierarchical-storage magic. It's still in development,
but ... well, I'll let you talk with him about it.

Best,
Baron

On Tue, Apr 29, 2008 at 2:12 PM, Bruno B B Magalhães
<brunomagalhaes@blackbean.com.br> wrote:
> Just correcting my self,
>
> The hierarchical storage theory is "nested set model", and not
> "transverse". And also I know that oracle 10g has a hierarchical query, but
> I am more interested on pure SQL2 theories and solutions. And also, SHOULD
> (or could) MySQL have some type or recursive query? For example:
>
> SELECT RECURSIVE *
> FROM ProductsCategories
> USING ProductCategoryParentID = ProductCategoryID
>
> Is this syntax factive?
>
> Best regards,
>
> Bruno B. B. Magalhães
>
> BLACKBEAN CONSULTORIA
> Rua Real Grandeza 193/210, Botafogo
> Rio de Janeiro, RJ, 22281-035, Brasil
>
> +55 (21) 9996-1093
> +55 (21) 2266-0597
> www.blackbean.com.br
>
> Esta mensagem pode conter informação confidencial e/ou privilegiada.Se
> você não for o destinatário ou a pessoa autorizada a receber esta mensagem,
> não pode usar, copiar ou divulgar as informações nela contidas ou tomar
> qualquer ação baseada nessas informações. Se você recebeu esta mensagem por
> engano, por favor avise imediatamente o remetente, respondendo o e-mail eem
> seguida apague-o. Agradecemos sua cooperação.
>
> This message may contain confidential and/or privileged information. If you
> are not the addressee or authorized to receive this for the addressee, you
> must not use, copy, disclose or take any action based on this message or any
> information herein. If you have received this message in error, please
> advise the sender immediately by reply e-mail and delete this message. Thank
> you for your cooperation.
>
>
> On Apr 29, 2008, at 1:21 PM, Bruno B B Magalhães wrote:
>
>
> >
> >
> >
> > Hi everybody,
> >
> > I would like to discuss there hierarchical storage theory. Currently I

> have came across 2 types for storing hierarchical data (yes, I´ve read the
> article at mysql.com, and MANY others sites), but I would like to know your
> option about the day-to-day usage... I mean I´ve only used hierarchy for
> some small to medium projects, but I now I am planning a big account project
> (yes, I´ve researched many open-source solutions, but none was suitablefor
> an enterprise level solution), and if someone has already walked this
> path... Well, I would like to share and discuss... How Oracle, SAP and
> Microsoft Dynamics did? Some one has some insight? ow they manage to store
> UNSPSC taxonomy data on their systems?
> >
> > Here is a table using parent and child relationship:
> >
> > CREATE TABLE `CatalogsCategories` (
> > `CustomerID` int(8) unsigned NOT NULL default '0',
> > `CatalogID` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryParentID` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryID` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryCode` varchar(20) NOT NULL default '',
> > `CatalogCategoryName` varchar(200) NOT NULL default '',
> > `CatalogCategoryDescription` text character set latin1 NOT NULL,
> > `CatalogCategoryActive` int(1) unsigned NOT NULL default '0',
> > `CatalogCategoryCreatedBy` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryCreatedOn` int(20) unsigned NOT NULL default '0',
> > `CatalogCategoryModifiedBy` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryModifiedOn` int(20) unsigned NOT NULL default '0',
> > `CatalogCategoryRemovedBy` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryRemovedOn` int(20) unsigned NOT NULL default '0',
> > KEY `CatalogsCategoriesIndexA`

> (`CustomerID`,`CatalogID`,`CatalogCategoryParentID
> `,`CatalogCategoryID`,`CatalogCategoryActive`),
> > KEY `CatalogsCategoriesIndexB`

> (`CatalogCategoryCreatedBy`,`CatalogCategoryModifi edBy`,`CatalogCategoryRemovedBy`),
> > KEY `CatalogsCategoriesIndexC`

> (`CatalogCategoryCreatedOn`,`CatalogCategoryModifi edOn`,`CatalogCategoryRemovedOn`)
> > ) ENGINE=InnoDB DEFAULT CHARSET=utf8
> >
> > Pros: Easy to understand and implement the operating clas es, not export /

> inport friendly
> > Cons: Recursive behavior, not suited for reports generation because of the

> recursivity
> >
> >
> > Here is a table using transverse relationship:
> >
> > CREATE TABLE `CatalogsCategories` (
> > `CustomerID` int(8) unsigned NOT NULL default '0',
> > `CatalogID` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryID` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryLeftPosition` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryRightPosition` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryCode` varchar(20) NOT NULL default '',
> > `CatalogCategoryName` varchar(200) NOT NULL default '',
> > `CatalogCategoryDescription` text character set latin1 NOT NULL,
> > `CatalogCategoryActive` int(1) unsigned NOT NULL default '0',
> > `CatalogCategoryCreatedBy` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryCreatedOn` int(20) unsigned NOT NULL default '0',
> > `CatalogCategoryModifiedBy` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryModifiedOn` int(20) unsigned NOT NULL default '0',
> > `CatalogCategoryRemovedBy` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryRemovedOn` int(20) unsigned NOT NULL default '0',
> > KEY `CatalogsCategoriesIndexA`

> (`CustomerID`,`CatalogID`,`CatalogCategoryID`,`Cat alogCategoryActive`),
> > KEY `CatalogsCategoriesIndexB`

> (`CatalogCategoryLeftPosition`,`CatalogCategoryRig htPosition`),
> > KEY `CatalogsCategoriesIndexC`

> (`CatalogCategoryCreatedBy`,`CatalogCategoryModifi edBy`,`CatalogCategoryRemovedBy`),
> > KEY `CatalogsCategoriesIndexD`

> (`CatalogCategoryCreatedOn`,`CatalogCategoryModifi edOn`,`CatalogCategoryRemovedOn`)
> > ) ENGINE=InnoDB DEFAULT CHARSET=utf8
> >
> > Pros: SQL friendly so much less processing and queries required, not

> export / inport friendly
> > Coms: Not that easy to understand or implement the operating classes
> >
> > Here is a table using UNSPSC like relationship:
> >
> > CREATE TABLE `CatalogsCategories` (
> > `CustomerID` int(8) unsigned NOT NULL default '0',
> > `CatalogID` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryID` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryLevel1` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryLevel2` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryLevel3` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryLevel4` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryCode` varchar(20) NOT NULL default '',
> > `CatalogCategoryName` varchar(200) NOT NULL default '',
> > `CatalogCategoryDescription` text character set latin1 NOT NULL,
> > `CatalogCategoryActive` int(1) unsigned NOT NULL default '0',
> > `CatalogCategoryCreatedBy` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryCreatedOn` int(20) unsigned NOT NULL default '0',
> > `CatalogCategoryModifiedBy` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryModifiedOn` int(20) unsigned NOT NULL default '0',
> > `CatalogCategoryRemovedBy` int(8) unsigned NOT NULL default '0',
> > `CatalogCategoryRemovedOn` int(20) unsigned NOT NULL default '0',
> > KEY `CatalogsCategoriesIndexA`

> (`CustomerID`,`CatalogID`,`CatalogCategoryID`,`Cat alogCategoryActive`),
> > KEY `CatalogsCategoriesIndexB`

> (`CatalogCategoryLevel1`,`CatalogCategoryLevel2`,` CatalogCategoryLevel3`,`CatalogCategoryLevel4`),
> > KEY `CatalogsCategoriesIndexC`

> (`CatalogCategoryCreatedBy`,`CatalogCategoryModifi edBy`,`CatalogCategoryRemovedBy`),
> > KEY `CatalogsCategoriesIndexD`

> (`CatalogCategoryCreatedOn`,`CatalogCategoryModifi edOn`,`CatalogCategoryRemovedOn`)
> > ) ENGINE=InnoDB DEFAULT CHARSET=utf8
> >
> > Pros: SQL friendly so much less processing and queries required, very

> export / inport friendly
> > Cons: Fixed deep and a little bit more difficult to implement the

> operating classes than parent/child relationships
> >
> > I would like very much to hear your opinions!
> >
> > Best regards to you all,
> > Bruno B. B. Magalhães
> >
> > BLACKBEAN CONSULTORIA
> > Rua Real Grandeza 193/210, Botafogo
> > Rio de Janeiro, RJ, 22281-035, Brasil
> >
> > +55 (21) 9996-1093
> > +55 (21) 2266-0597
> > www.blackbean.com.br
> >
> > Esta mensagem pode conter informação confidencial e/ou privilegiada.. Se

> você não for o destinatário ou a pessoa autorizada a receber esta mensagem,
> não pode usar, copiar ou divulgar as informações nela contidas ou tomar
> qualquer ação baseada nessas informações. Se você recebeu esta mensagem por
> engano, por favor avise imediatamente o remetente, respondendo o e-mail eem
> seguida apague-o. Agradecemos sua cooperação.
> >
> > This message may contain confidential and/or privileged information. If

> you are not the addressee or authorized to receive this for the addressee,
> you must not use, copy, disclose or take any action based on this messageor
> any information herein. If you have received this message in error, please
> advise the sender immediately by reply e-mail and delete this message. Thank
> you for your cooperation.
> >
> >
> > --
> > MySQL General Mailing List
> > For list archives: http://lists.mysql.com/mysql
> > To unsubscribe:

> http://lists.mysql.com/mysql?unsub=b...ackbean.com.br
> >
> >

>
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=baron@xaprb.com
>
>




--

Baron Schwartz, Senior Consultant, Percona Inc.
Tel: +1 888 401 3401 ext 507
24/7 Emergency Line +1 888 401 3401 ext 911
Our Services: http://www.percona.com/services.html
Our Blog: http://www.mysqlperformanceblog.com/
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-29-2008, 08:27 PM
=?ISO-8859-1?Q?Bruno_B_B_Magalh=E3es?=
 
Posts: n/a
Default Re: Practical hierarchies

Just correcting my self,

The hierarchical storage theory is "nested set model", and not
"transverse". And also I know that oracle 10g has a hierarchical
query, but I am more interested on pure SQL2 theories and solutions.
And also, SHOULD (or could) MySQL have some type or recursive query?
For example:

SELECT RECURSIVE *
FROM ProductsCategories
USING ProductCategoryParentID = ProductCategoryID

Is this syntax factive?

Best regards,
Bruno B. B. Magalhães

BLACKBEAN CONSULTORIA
Rua Real Grandeza 193/210, Botafogo
Rio de Janeiro, RJ, 22281-035, Brasil

+55 (21) 9996-1093
+55 (21) 2266-0597
www.blackbean.com.br

Esta mensagem pode conter informação confidencial e/ou privilegiada.
Se você não for o destinatário ou a pessoa autorizada a receber esta
mensagem, não pode usar, copiar ou divulgar as informações nela
contidas ou tomar qualquer ação baseada nessas informações. Se você
recebeu esta mensagem por engano, por favor avise imediatamente o
remetente, respondendo o e-mail e em seguida apague-o. Agradecemos sua
cooperação.

This message may contain confidential and/or privileged information.
If you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose or take any action based
on this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation.

On Apr 29, 2008, at 1:21 PM, Bruno B B Magalhães wrote:

> Hi everybody,
>
> I would like to discuss there hierarchical storage theory. Currently
> I have came across 2 types for storing hierarchical data (yes, I´ve
> read the article at mysql.com, and MANY others sites), but I would
> like to know your option about the day-to-day usage... I mean I´ve
> only used hierarchy for some small to medium projects, but I now I
> am planning a big account project (yes, I´ve researched many open-
> source solutions, but none was suitable for an enterprise level
> solution), and if someone has already walked this path... Well, I
> would like to share and discuss... How Oracle, SAP and Microsoft
> Dynamics did? Some one has some insight? ow they manage to store
> UNSPSC taxonomy data on their systems?
>
> Here is a table using parent and child relationship:
>
> CREATE TABLE `CatalogsCategories` (
> `CustomerID` int(8) unsigned NOT NULL default '0',
> `CatalogID` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryParentID` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryID` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryCode` varchar(20) NOT NULL default '',
> `CatalogCategoryName` varchar(200) NOT NULL default '',
> `CatalogCategoryDescription` text character set latin1 NOT NULL,
> `CatalogCategoryActive` int(1) unsigned NOT NULL default '0',
> `CatalogCategoryCreatedBy` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryCreatedOn` int(20) unsigned NOT NULL default '0',
> `CatalogCategoryModifiedBy` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryModifiedOn` int(20) unsigned NOT NULL default '0',
> `CatalogCategoryRemovedBy` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryRemovedOn` int(20) unsigned NOT NULL default '0',
> KEY `CatalogsCategoriesIndexA`
> (`CustomerID`,`CatalogID`,`CatalogCategoryParentID
> `,`CatalogCategoryID`,`CatalogCategoryActive`),
> KEY `CatalogsCategoriesIndexB`
> (`
> CatalogCategoryCreatedBy
> `,`CatalogCategoryModifiedBy`,`CatalogCategoryRemo vedBy`),
> KEY `CatalogsCategoriesIndexC`
> (`
> CatalogCategoryCreatedOn
> `,`CatalogCategoryModifiedOn`,`CatalogCategoryRemo vedOn`)
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8
>
> Pros: Easy to understand and implement the operating clas es, not
> export / inport friendly
> Cons: Recursive behavior, not suited for reports generation because
> of the recursivity
>
>
> Here is a table using transverse relationship:
>
> CREATE TABLE `CatalogsCategories` (
> `CustomerID` int(8) unsigned NOT NULL default '0',
> `CatalogID` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryID` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryLeftPosition` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryRightPosition` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryCode` varchar(20) NOT NULL default '',
> `CatalogCategoryName` varchar(200) NOT NULL default '',
> `CatalogCategoryDescription` text character set latin1 NOT NULL,
> `CatalogCategoryActive` int(1) unsigned NOT NULL default '0',
> `CatalogCategoryCreatedBy` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryCreatedOn` int(20) unsigned NOT NULL default '0',
> `CatalogCategoryModifiedBy` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryModifiedOn` int(20) unsigned NOT NULL default '0',
> `CatalogCategoryRemovedBy` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryRemovedOn` int(20) unsigned NOT NULL default '0',
> KEY `CatalogsCategoriesIndexA`
> (`
> CustomerID`,`CatalogID`,`CatalogCategoryID`,`Catal ogCategoryActive`),
> KEY `CatalogsCategoriesIndexB`
> (`CatalogCategoryLeftPosition`,`CatalogCategoryRig htPosition`),
> KEY `CatalogsCategoriesIndexC`
> (`
> CatalogCategoryCreatedBy
> `,`CatalogCategoryModifiedBy`,`CatalogCategoryRemo vedBy`),
> KEY `CatalogsCategoriesIndexD`
> (`
> CatalogCategoryCreatedOn
> `,`CatalogCategoryModifiedOn`,`CatalogCategoryRemo vedOn`)
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8
>
> Pros: SQL friendly so much less processing and queries required, not
> export / inport friendly
> Coms: Not that easy to understand or implement the operating classes
>
> Here is a table using UNSPSC like relationship:
>
> CREATE TABLE `CatalogsCategories` (
> `CustomerID` int(8) unsigned NOT NULL default '0',
> `CatalogID` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryID` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryLevel1` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryLevel2` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryLevel3` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryLevel4` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryCode` varchar(20) NOT NULL default '',
> `CatalogCategoryName` varchar(200) NOT NULL default '',
> `CatalogCategoryDescription` text character set latin1 NOT NULL,
> `CatalogCategoryActive` int(1) unsigned NOT NULL default '0',
> `CatalogCategoryCreatedBy` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryCreatedOn` int(20) unsigned NOT NULL default '0',
> `CatalogCategoryModifiedBy` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryModifiedOn` int(20) unsigned NOT NULL default '0',
> `CatalogCategoryRemovedBy` int(8) unsigned NOT NULL default '0',
> `CatalogCategoryRemovedOn` int(20) unsigned NOT NULL default '0',
> KEY `CatalogsCategoriesIndexA`
> (`
> CustomerID`,`CatalogID`,`CatalogCategoryID`,`Catal ogCategoryActive`),
> KEY `CatalogsCategoriesIndexB`
> (`
> CatalogCategoryLevel1
> `
> ,`
> CatalogCategoryLevel2
> `,`CatalogCategoryLevel3`,`CatalogCategoryLevel4`) ,
> KEY `CatalogsCategoriesIndexC`
> (`
> CatalogCategoryCreatedBy
> `,`CatalogCategoryModifiedBy`,`CatalogCategoryRemo vedBy`),
> KEY `CatalogsCategoriesIndexD`
> (`
> CatalogCategoryCreatedOn
> `,`CatalogCategoryModifiedOn`,`CatalogCategoryRemo vedOn`)
> ) ENGINE=InnoDB DEFAULT CHARSET=utf8
>
> Pros: SQL friendly so much less processing and queries required,
> very export / inport friendly
> Cons: Fixed deep and a little bit more difficult to implement the
> operating classes than parent/child relationships
>
> I would like very much to hear your opinions!
>
> Best regards to you all,
> Bruno B. B. Magalhães
>
> BLACKBEAN CONSULTORIA
> Rua Real Grandeza 193/210, Botafogo
> Rio de Janeiro, RJ, 22281-035, Brasil
>
> +55 (21) 9996-1093
> +55 (21) 2266-0597
> www.blackbean.com.br
>
> Esta mensagem pode conter informação confidencial e/ou privilegiada.
> Se você não for o destinatário ou a pessoa autorizada a receber esta
> mensagem, não pode usar, copiar ou divulgar as informações nela
> contidas ou tomar qualquer ação baseada nessas informações. Se você
> recebeu esta mensagem por engano, por favor avise imediatamente o
> remetente, respondendo o e-mail e em seguida apague-o. Agradecemos
> sua cooperação.
>
> This message may contain confidential and/or privileged information.
> If you are not the addressee or authorized to receive this for the
> addressee, you must not use, copy, disclose or take any action based
> on this message or any information herein. If you have received this
> message in error, please advise the sender immediately by reply e-
> mail and delete this message. Thank you for your cooperation.
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=b...ackbean.com.br
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:45 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145