-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Associations many-to-many et des tables partitionnees
PostPosted: Wed Dec 19, 2012 2:59 am 
Beginner
Beginner

Joined: Sat Jan 05, 2008 7:33 am
Posts: 26
En supposant avoir 2 entités mappees dans la DB comme suit:

<hibernate-mapping default-lazy="false" default-cascade="all" package="myentities">
<class name="TableOfContents" table="TblOfContents">
<id name="dbId" column="db_id" type="long">
<generator class="native"/>
</id>
<timestamp name="lastModified" column="last_modified" source="db"/>
<property name="created" type="timestamp" insert="false" update="false" generated="insert"/>
<property name="digest" column="digest" type="string"/>

<!-- IMPORTANT Note: The following "key" pseudo property describe the "unicity" of a TOC object in the DB -->
<properties name="key" unique="true">
<property name="active" column="is_active" type="boolean" not-null="true" index="ix_toc_ac"/>
<property name="partId" type="long"> <column name="partition_id" index="ix_toc" not-null="true" default="0"/> </property>
<property name="name" column="entry" type="string" not-null="true" index="ix_tocs"/>
</properties>

<set lazy="true" name="entries" table="lt_toc_entries">
<key column="toc_id" foreign-key="fk_toc_entry"/>
<many-to-many class="TOCEntry" column="entry_id" foreign-key="fk_entry_toc"/>
</set>
</hibernate-mapping>

<hibernate-mapping default-lazy="false" default-cascade="all" package="myentities">
<class name="TOCEntry" table="TOCEntries">
<id name="dbId" column="db_id" type="long">
<generator class="native"/>
</id>
<timestamp name="lastModified" column="last_modified" source="db"/>
<property name="created" type="timestamp" insert="false" update="false" generated="insert"/>
<property name="digest" column="digest" type="string"/>

<!-- IMPORTANT Note: The following "key" pseudo property describe the "unicity" of a TOCEntry object in the DB -->
<properties name="key" unique="true">
<property name="active" column="is_active" type="boolean" not-null="true" index="ix_tocentries_ac"/>
<property name="partId" column="partition_id" type="long" not-null="true" index="ix_tocentries"/>
<property name="fulltext" column="fulltext" length="800" type="string" not-null="true" index="ix_tocentries"/>
<property name="TOCId" column="toc_id" type="long" not-null="true" index="ix_tocentries_id"/>
</properties>
</hibernate-mapping>

En faisant de la sorte, les 2 entités sont liees: depuis une TOC je peux récupérer les TOCEntries et vice-versa en utilisant le toc_id
Disons que la table TOC a 1.5 millions d'entrées et que TOCEntries en a 280 millions !!!
J'ai réussi assez facilement a partitionner les deux tables en utilisant la colonne partition_id ce qui avec une trentaine
de partition_id differents me donne des "sous-tables" de grandeur suffisamment faible pour optimiser mes requêtes
Cependant la table d'association lt_toc_entries table contient 280 million entries et n'est pas quant a elle partitionnee
ce qui peut definitivement devenir un probleme a term

Y a t il un moyen de parvenir a mes fins
Merci pour votre aide


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.