db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Carl <patrick.c...@coi.de>
Subject Performance problem
Date Thu, 21 Oct 2004 11:33:07 GMT
Hi there,

I am using Torque and like it very much. But now I have a performance

I am searching for documents depending on their related attributes. A
document can have 0 to many attributes. The table strucuture is defined


    <table name="document" description="Represents a Document">
        <column name="id" type="INTEGER" primaryKey="true"
autoIncrement="true" required="true"/>
        <column name="archive" type="VARCHAR" size="20"
javaName="archive" description="source archive"/>
        <column name="archiveid" type="VARCHAR" size="20"
javaName="archiveId" description="ID in the source archive"/>
        <column name="name" type="VARCHAR" size="255"

    <table name="attribute" description="Represents an attribute of a
        <column name="id" autoIncrement="true" type="INTEGER"
primaryKey="true" required="true"/>
        <column name="docid" javaName="docId" type="INTEGER"
description="Related document"/>
        <column name="configid" javaName="configId" type="INTEGER"
description="Related attrconfig"/>
        <column name="value" type="VARCHAR" size="255"/>
        <column name="valuedouble" type="DOUBLE"
        <column name="valuelong" type="BIGINT" javaName="valueAsLong"/>
        <column name="valuesearch" type="VARCHAR" size="255"
javaName="searchValue" description="special search value"/>
        <column name="language" type="VARCHAR" size="15"
description="language of this attribute"/>
        <foreign-key foreignTable="document" name="fk_attr_doc"
            <reference local="docid" foreign="id" />
        <foreign-key foreignTable="attrconfig" name="fk_attr_cfg">
            <reference local="configid" foreign="id"/>
        <index name="idx_atr_doc">
            <index-column name="docid"/>
            <index-column name="language"/>
        <index name="idx_atr_doc_lang_search">
            <index-column name="docid"/>
            <index-column name="valuesearch"/>
            <index-column name="language"/>
        <index name="idx_atr_doc_lang_search">
            <index-column name="docid"/>
            <index-column name="valuesearch"/>
            <index-column name="language"/>

My code looks like:

Criteria crit = new Criteria();
crit.addJoin(DocumentPeer.ID, AttributePeer.DOCID);
crit.add(AttributePeer.CONFIGID, 17);
crit.add(AttributePeer.VALUESEARCH, (Object) searchPattern,
crit.add(AttributePeer.LANGUAGE, "en");
List res = DocumentPeer.doSelect(crit);

Such a search takes about 50 seconds.Performance gets worse the more
attributes and documents are inserted.

When executing the following SQL directly at the database the result is
received in much less than one second.

I am using Hypersonic 1.7.2. Is there any advice you can give me?

Thanks in advance!


To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message