You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Josef Duschl <Du...@CreamTeam.de> on 2009/11/19 18:25:25 UTC

Performance Problems: Derby & Hibernate - Update of many entries in a table with foreign key constraints

Hi there,

I'm using Derby and Hibernate (coupled to EMF & Teneo) in an Eclipse rich
client application. The Derby version is 10.5.3.0, the Hibernate tools
version is 3.2.4.GA-R200905070146-H18.

My application implements a synchronization mechanism, which pulls Objects
off a Webservice. There are master data objects which need to be completely
synchronized every time because there are no version or change information
available. This results in a lot of updated rows in the tables.

Upon saving the Hibernate EMF resource, the program grinds to a halt in the
following place: 
Thread [ModalContext] (Suspended)	
	UpdateResultSet.foundRow(ExecRow, int[], TemporaryRowHolderImpl)
line: 1013	
	UpdateResultSet.runChecker(boolean) line: 975	
	UpdateResultSet.open() line: 264	
	GenericPreparedStatement.executeStmt(Activation, boolean, long)
line: 416	
	GenericPreparedStatement.execute(Activation, long) line: 297	
	
EmbedPreparedStatement30(EmbedStatement).executeStatement(Activation,
boolean, boolean) line: 1235	
	
EmbedPreparedStatement30(EmbedPreparedStatement).executeStatement(Activation
, boolean, boolean) line: 1675	
	EmbedPreparedStatement30(EmbedPreparedStatement).executeUpdate()
line: 302	
	NonBatchingBatcher.addToBatch(Expectation) line: 23	
	OneToManyPersister(AbstractCollectionPersister).remove(Serializable,
SessionImplementor) line: 1048	
	CollectionUpdateAction.execute() line: 41	
	ActionQueue.execute(Executable) line: 250	
	ActionQueue.executeActions(List) line: 234	
	ActionQueue.executeActions() line: 144	
	
DefaultFlushEventListener(AbstractFlushingEventListener).performExecutions(E
ventSource) line: 298	
	DefaultFlushEventListener.onFlush(FlushEvent) line: 27	
	SessionImpl.flush() line: 1000	
	HbSessionWrapper.flush() line: 171	
	HibernateResource.saveResource(Map<?,?>) line: 375	
	HibernateResource(StoreResource).save(Map<?,?>) line: 430	
	SynchronizationWizard$1.run(IProgressMonitor) line:
	ModalContext$ModalContextThread.run() line: 121	

There are two nested while loos in runChecker and foundRow which iterate
over the same data. One call of foundRow takes about 3 seconds. The result
sets contain >2000 elements as far as I can see.

Is there any way to disable these checks or to make them faster (ie utilize
the index on the primary key of the table)?

Kind Regards,

Josef