db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: [Fwd: last issue with completeness test]
Date Tue, 18 Apr 2006 16:49:59 GMT
Hi Jörg,

Just to be clear: this improves performance only in the case that you  
know what specific class you are looking for (you have a relationship  
to a specific most-derived subclass) and there is not another more  
appropriate index to optimize on. So it's worthless in the generic  
query use case because there will typically be a more restrictive  
index, and of little value in the navigation case because you are  
joining on a foreign key anyway. So it's only useful for a table scan  
of a most-derived subclass or superclass Extent with  
includeSubclasses==false.

This came out more harshly than I thought it would when I started. Is  
there a good use case for indexing the discriminator column?

Regards,

Craig

On Apr 18, 2006, at 9:22 AM, Jörg von Frantzius wrote:

> Craig Russell schrieb:
>> Hi Erik,
>>
>> It's probably not related to the problem, but why do you declare an
>> index defined on the discriminator columns in the metadata?
>>
> Yes I'm not Erik but still: in our production system we do that to  
> increase performance of queries. We'd even like to have that by  
> default.
>> The only other odd thing is the change to projects: <property
>> name="projects" mapped-by="members"/>
>>
>> There's nothing else that I can see that would cause a problem
>> deleting instances. Where does the error show up?
>>
>> Craig
>>
>> P.S. until Monday, please reply to papajdo@gmail.com in addition  
>> to jdo-dev.
>>
>> On 4/15/06, Michelle Caisse <Michelle.Caisse@sun.com> wrote:
>>
>>>  -------- Original Message --------
>>> Subject: last issue with completeness test
>>> Date: Sat, 15 Apr 2006 18:51:11 -0700
>>> From: Erik Bengtson <erik@jpox.org>
>>> Reply-To: jdo-dev@db.apache.org
>>> To: jdo-dev@db.apache.org
>>>
>>>  Hi,
>>>
>>> JPOX now passes completeness interface test in my local  
>>> workspace, but
>>> apparently the tables are not cleaned out completely on tear  
>>> down. It passes
>>> if
>>> it is the only configuration enabled. Can someone take a look on  
>>> that?
>>>
>>> Here my changes to the schema and metadata files adding  
>>> discriminator column
>>> to
>>> tables.
>>>
>>> Index:
>>> D:/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql
>>> ===================================================================
>>> ---
>>> D:/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql
>>> (revision
>>> 391636)
>>> +++
>>> D:/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema.sql
>>> (working copy)
>>> @@ -130,6 +130,7 @@
>>>  STATE CHAR(2),
>>>  ZIPCODE CHAR(5),
>>>  COUNTRY VARCHAR(64),
>>> + DISCRIMINATOR VARCHAR(255),
>>>  CONSTRAINT COMPS_PK PRIMARY KEY (DATASTORE_IDENTITY)
>>>  );
>>>
>>> @@ -139,6 +140,7 @@
>>>  NAME VARCHAR(32) NOT NULL,
>>>  EMP_OF_THE_MONTH INTEGER,
>>>  COMPANYID INTEGER REFERENCES companies,
>>> + DISCRIMINATOR VARCHAR(255),
>>>  CONSTRAINT DEPTS_PK PRIMARY KEY (DATASTORE_IDENTITY)
>>>  );
>>>
>>> @@ -185,6 +187,7 @@
>>>  PROJID INTEGER NOT NULL,
>>>  NAME VARCHAR(32) NOT NULL,
>>>  BUDGET DECIMAL(11,2) NOT NULL,
>>> + DISCRIMINATOR VARCHAR(255),
>>>  CONSTRAINT PROJS_UK UNIQUE (PROJID),
>>>  CONSTRAINT PROJS_PK PRIMARY KEY (DATASTORE_IDENTITY)
>>>  );
>>> Index:
>>> D:/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql
>>> ===================================================================
>>> ---
>>> D:/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql
>>> (revision
>>> 391636)
>>> +++
>>> D:/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql
>>> (working
>>> copy)
>>> @@ -182,6 +182,7 @@
>>>  STATE CHAR(2),
>>>  ZIPCODE CHAR(5),
>>>  COUNTRY VARCHAR(64),
>>> + DISCRIMINATOR VARCHAR(255),
>>>  CONSTRAINT COMPS_PK PRIMARY KEY (ID)
>>>  );
>>>
>>> @@ -190,6 +191,7 @@
>>>  NAME VARCHAR(32) NOT NULL,
>>>  EMP_OF_THE_MONTH INTEGER,
>>>  COMPANYID INTEGER REFERENCES companies,
>>> + DISCRIMINATOR VARCHAR(255),
>>>  CONSTRAINT DEPTS_PK PRIMARY KEY (ID)
>>>  );
>>>
>>> @@ -232,6 +234,7 @@
>>>  PROJID INTEGER NOT NULL,
>>>  NAME VARCHAR(32) NOT NULL,
>>>  BUDGET DECIMAL(11,2) NOT NULL,
>>> + DISCRIMINATOR VARCHAR(255),
>>>  CONSTRAINT PROJS_PK PRIMARY KEY (PROJID)
>>>  );
>>>
>>> Index:
>>> D:/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/ 
>>> pc/company/package-standard.orm
>>> ===================================================================
>>> ---
>>> D:/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/ 
>>> pc/company/package-standard.orm
>>> (revision
>>> 388908)
>>> +++
>>> D:/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/ 
>>> pc/company/package-standard.orm
>>> (working
>>> copy)
>>> @@ -11,6 +11,11 @@
>>>
>>>  <class name="Company" table="companies">
>>>  <datastore-identity strategy="identity"
>>> column="DATASTORE_IDENTITY"/>
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="COM_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <field name="companyid" column="ID"/>
>>>  <field name="name" column="NAME">
>>>  <column name="NAME" sql-type="VARCHAR"/>
>>> @@ -43,6 +48,11 @@
>>>
>>>  <class name="Department" table="departments">
>>>  <datastore-identity strategy="identity"
>>> column="DATASTORE_IDENTITY"/>
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="DPT_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <field name="deptid" column="ID"/>
>>>  <field name="name" column="NAME"/>
>>>  <field name="company" column="COMPANYID"/>
>>> @@ -149,6 +159,11 @@
>>>
>>>  <class name="Project" table="projects">
>>>  <datastore-identity strategy="identity"
>>> column="DATASTORE_IDENTITY"/>
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="PRJ_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <field name="projid" column="PROJID"/>
>>>  <field name="name" column="NAME"/>
>>>  <field name="budget">
>>> @@ -168,6 +183,11 @@
>>>
>>>  <interface name="ICompany" table="companies">
>>>  <datastore-identity strategy="identity"
>>> column="DATASTORE_IDENTITY"/>
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="COM_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <property name="companyid" column="ID"/>
>>>  <property name="name" column="NAME">
>>>  <column name="NAME" sql-type="VARCHAR"/>
>>> @@ -188,6 +208,11 @@
>>>
>>>  <interface name="IDepartment" table="departments">
>>>  <datastore-identity strategy="identity"
>>> column="DATASTORE_IDENTITY"/>
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="DPT_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <property name="deptid" column="ID"/>
>>>  <property name="name" column="NAME"/>
>>>  <property name="company" column="COMPANYID"/>
>>> @@ -306,6 +331,11 @@
>>>
>>>  <interface name="IProject" table="projects">
>>>  <datastore-identity strategy="identity"
>>> column="DATASTORE_IDENTITY"/>
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="PRJ_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <property name="projid" column="PROJID"/>
>>>  <property name="name" column="NAME"/>
>>>  <property name="budget">
>>> Index:
>>> D:/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/ 
>>> pc/company/package-standard.orm
>>> ===================================================================
>>> ---
>>> D:/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/ 
>>> pc/company/package-standard.orm
>>> (revision
>>> 388908)
>>> +++
>>> D:/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/ 
>>> pc/company/package-standard.orm
>>> (working
>>> copy)
>>> @@ -10,6 +10,11 @@
>>>  <package name="org.apache.jdo.tck.pc.company">
>>>
>>>  <class name="Company" table="companies">
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="COM_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <field name="companyid" column="ID"/>
>>>  <field name="name" column="NAME">
>>>  <column name="NAME" sql-type="VARCHAR"/>
>>> @@ -29,6 +34,11 @@
>>>  </class>
>>>
>>>  <class name="Department" table="departments">
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="DPT_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <field name="deptid" column="ID"/>
>>>  <field name="name" column="NAME"/>
>>>  <field name="company" column="COMPANYID"/>
>>> @@ -144,6 +154,11 @@
>>>  </class>
>>>
>>>  <class name="Project" table="projects">
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="PRJ_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <field name="projid" column="PROJID"/>
>>>  <field name="name" column="NAME"/>
>>>  <field name="budget">
>>> @@ -164,6 +179,11 @@
>>>  </class>
>>>
>>>  <interface name="ICompany" table="companies">
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="COM_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <property name="companyid" column="ID"/>
>>>  <property name="name" column="NAME">
>>>  <column name="NAME" sql-type="VARCHAR"/>
>>> @@ -183,6 +203,11 @@
>>>  </interface>
>>>
>>>  <interface name="IDepartment" table="departments">
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="DPT_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <property name="deptid" column="ID"/>
>>>  <property name="name" column="NAME"/>
>>>  <property name="company" column="COMPANYID"/>
>>> @@ -224,8 +249,7 @@
>>>  <foreign-key/>
>>>  </property>
>>>  <property name="reviewedProjects" mapped-by="reviewers">
>>> - </property>
>>> - <property name="projects" mapped-by="members"/>
>>> + </property> <property name="projects"
>>> mapped-by="members"/>
>>>  <property name="team" mapped-by="manager"/>
>>>  <property name="hradvisees" mapped-by="hradvisor"/>
>>>  </interface>
>>> @@ -298,6 +322,11 @@
>>>  </interface>
>>>
>>>  <interface name="IProject" table="projects">
>>> + <inheritance strategy="new-table">
>>> + <discriminator strategy="class-name" column="DISCRIMINATOR">
>>> + <index name="PRJ_DISCRIMINATOR_INDEX" unique="false"/>
>>> + </discriminator>
>>> + </inheritance>
>>>  <property name="projid" column="PROJID"/>
>>>  <property name="name" column="NAME"/>
>>>  <property name="budget">
>>>
>>>
>>>
>>>
>>
>>
>


Mime
View raw message