Hello Rinse,

Firs of all, I think that you are mistaken about GitHub Issue #4247 
<https://github.com/h2database/h2database/issues/4247>. It has nothing to 
do with SHUTDOWN COMPACT (which does a full database compaction), but 
rather regular SHUTDOWN (which dose some partial time-limited compaction 
using totally different algorithm).
As far as your architecture goes, It is not clear whether you need to join 
such temp table with the rest of the database, or just need 
filtering/sorting on a table alone? If joins are not needed, you can create 
temp database on a client side and put it there.


On Thursday, July 24, 2025 at 1:23:43 PM UTC-4 Rinse Lemstra wrote:

> We would appreciate your advice.
>
> In our application, we make intensive use of the construction involving 
> temporary tables:
>
> create memory local temporary table if not exists temp_report as select * 
> from ( .... )
>
> We use this, for instance, in reporting functionality. This allows 
> calculated fields to behave like physical fields, enabling users to create 
> filters based on the actual values found.
>
> We also use this approach to keep complex queries readable and to prevent 
> the query optimizer from making incorrect choices regarding indexes.
>
> However, this construction has the drawback that the size of the database 
> can grow very quickly, which has a dramatic effect on performance. A 
> SHUTDOWN COMPACT resolves the problem completely — the database shrinks 
> significantly in size, and performance improves again.
>
> Unfortunately, SHUTDOWN COMPACT is disruptive in production and is not 
> stable in the current version, see GitHub Issue #4247 
> <https://github.com/h2database/h2database/issues/4247>, which can even 
> lead to data loss.
>
> Ideally, we would like to move the use of these temporary tables 
> completely outside of the regular database — for example, to a temporary 
> database. Moving everything entirely to RAM is not feasible due to the 
> number of users we need to support.
>
> Does anyone have advice?
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/h2-database/4377dc8e-9f8a-4bab-8351-f5754d184a57n%40googlegroups.com.

Reply via email to