|
[
Permlink
| « Hide
]
Jack Klebanoff added a comment - 17/Dec/04 05:12 PM
Do you know whether the memory overflow occurred during compilation or execution? Do you have a stack trace from the OutOfMemoryError? Do you know the sizes of the tables being joined?
The system property derby.language.maxMemoryPerTable is the system property I asked for. Setting it to 0 works like a charm and turns the hash join strategy off. So I'm happy and the bug can be closed. Perhaps this system property should be mentioned somewhere in the derby tuning manual.
For completenesss, if someone is still interested on details: The SQL query of interest is this one: SELECT c.* FROM AttrOcc c WHERE EXISTS (SELECT 'X' FROM Occ p WHERE c.OccID=p.ID AND p.DISCRIMINATOR=1) As you can see, there are two tables involved: A table Occ and a table Attrocc whereas the latter has a foreign key constraint on column OccID that refers to the primary key column ID of table Occ: CREATE TABLE Occ ( ID CHAR(15) PRIMARY KEY, DISCRIMINATOR NUMERIC(10), ... ) CREATE TABLE AttrOcc ( ID CHAR(15) PRIMARY KEY, OCCID CHAR(15) NOT NULL REFERENCES OCC ON DELETE CASCADE, ... ) There is no index on column Occ.DISCRIMINATOR. Table Occ has 267661 rows and table AttrOcc has 153084 rows. My testprogram runs with -Xmx128m. If I use default derby.language.maxMemoryPerTable (i.e.) 1024K, then the SQL statement above leads to that OutOfMemoryError. And the query take 192s for execution. If I create a compound index on Occ(ID,DISCRIMINATOR) and use default derby.language.maxMemoryPerTable (i.e.) 1024K, then it needs a bit less memory, so that it runs with -Xmx128. And it takes 140s to execute. So this is slighly better. If I set derby.language.maxMemoryPerTable to 0 (and without index on Occ(ID,DISCRIMINATOR)), then memory consumption is minimal: -Xmx48 is sufficient. And it takes only 19s to execute (This is an order of magnitude better than the derby.language.maxMemoryPerTable=1024 variant). Subversion revision 157861
Assigning to SQL component.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||