db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Katherine Marsden <kmarsdende...@sbcglobal.net>
Subject How Much Memory for hash joins
Date Wed, 27 Feb 2013 20:47:39 GMT
I was wondering what is the default maximum memory for hash joins.

Looking at OptimizerFactoryImpl I see
protected int maxMemoryPerTable = 1048576 unless overridden by 
Is actually intended  per table or per active query?  I don't see the 
property in the documentation.
If I set this to zero will it turn off hash joins all together?

In BackingStoreHashTableFromScan I see.

       this.max_inmemory_rowcnt = max_inmemory_rowcnt;
         if( max_inmemory_rowcnt > 0)
             max_inmemory_size = Long.MAX_VALUE;
             max_inmemory_size = Runtime.getRuntime().totalMemory()/100;

So what is the intent and actual behavior of 
"derby.language.maxMemoryPerTable" and its default and do they match? 
Are there other factors that go into setting the ceiling for memory 
usage for has joins.



In actual practice on a *very* old derby version   Apache Derby - - (330608) I am looking at a hprof dump which shows almost 2GB 
of Blob and clob objects that trace back to hash joins and a 
BAckingStoreHashTableFromScan objects that have values as below with 
max_inmemory_size as Long.MAX_VALUE as I would expect from the above code.

instance of 
(63 bytes)
class org.apache.derby.impl.store.access.BackingStoreHashTableFromScan
Instance data members:
auxillary_runtimestats (L) : <null>
diskHashtable (L) : <null>
hash_table (L) : java.util.Hashtable@0xa59f7d48 (40 bytes)
inmemory_rowcnt (J) : 8686
keepAfterCommit (Z) : false
key_column_numbers (L) : [I@0xa33b6110 (12 bytes)
max_inmemory_rowcnt (J) : 58254
max_inmemory_size (J) : 9223372036854775807
open_scan (L) : 
org.apache.derby.impl.store.access.heap.HeapScan@0xa59f7f10 (64 bytes)
remove_duplicates (Z) : false
row_source (L) : <null>
skipNullKeyColumns (Z) : true
tc (L) : org.apache.derby.impl.store.access.RAMTransaction@0x8f960428 
(57 bytes)
References to this object:
org.apache.derby.impl.sql.execute.HashScanResultSet@0xa33b5fc8 (321 
bytes) : field hashtable
Other Queries

View raw message