db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Knut Anders Hatlen <knut.hat...@oracle.com>
Subject Re: what do errors like these mean?
Date Fri, 21 Dec 2012 18:47:24 GMT
Pavel Bortnovskiy <pbortnovskiy@jefferies.com> writes:

> Thank you, Knut, for your prompt response.
>
> It seems that my caching of Prepared Statements is causing some problems.
> In some previous responses, it was indicated that Derby is caching
> them internally anyway, so maybe a better approach for me is not to
> cache them on my side and create them anew? Most of my inserts/updates
> are done in batches, so I could create a PrepStmt before the batch and
> remove a reference to it at the end of the batch's execution.

That sounds like a case where the internal cache could do a good job. If
the exact same query (identical SQL string) has been executed before,
and it's still in the cache (default cache size is 100, see [1]),
preparing the statement should essentially be just a lookup in a hash
table. I'd expect that cost to be negligible for most batches.

[1] https://db.apache.org/derby/docs/10.9/ref/rrefproperstatementcachesize.html

> If the
> performance penalty for compilation of PrepStmt is not that great,
> then such approach may be more desirable to avoid errors in the
> production environment.

Not sure if it will avoid the errors, as Derby should invalidate both
the active PreparedStatements and those in the internal cache. But there
may be bugs, of course, preventing one or the other from being
invalidated. Relying on the internal cache for the batches might help
simplifying the application code, though.

By the way, do you have the full stack trace for the exception you saw?
The original post only included the stack where the top-level
SQLException was created. There should be a StandardException nested in
the SQLException telling exactly where it fell over.

And do you regularly run SYSCS_COMPRESS_TABLE on the database? That has
been the most common source for these errors.

Which Derby version are you running?

Thanks,

-- 
Knut Anders

Mime
View raw message