In short in HSQLDB cached table sucks in terms of performance. En bref dans HSQLDB cache sucks tableau en termes de performances. To elaborate I was running a program which takes around 9 hours running on two medium sized cached tables (bigger one 163 MB). Pour élaborer Je courais un programme qui dure environ 9 heures de fonctionnement sur deux moyennes cache tableaux (un plus grand 163 Mo). I changed the tables to memory tables (default) and it now takes less than 10 minutes. J'ai changé les tableaux à la mémoire des tableaux (par défaut) et maintenant il prend moins de 10 minutes. Let’s see how we can easily convert memory table to cached table and vice-versa. Voyons comment nous pouvons facilement convertir la mémoire cache de table à table et vice-versa.


How can you convert a HSQLDB Memory Table to Cached Table? Comment pouvez-vous convertir un tableau HSQLDB Mémoire cache de tableau?

This one is easy. Celui-ci est facile. I just open the script file and change the word memory to cached in the create table statement. Je viens d'ouvrir le fichier de script et de changer le mot de mémoire cache dans la commande CREATE TABLE. It automatically converts it to cached table next time it is used. Il convertit automatiquement à table cache la prochaine fois elle est utilisée. The reverse is however more complex. L'inverse est cependant plus complexe.

How can you convert a HSQLDB CACHED Table to MEMORY Table? Comment pouvez-vous convertir un tableau HSQLDB cache de la mémoire tableau?

You need to create a temporary table and copy all the data (preferably using insert into … select * from … query) to that table. Vous devez créer une table temporaire et de copier toutes les données (de préférence en utilisant insérer… select * from requête…) à ce tableau. Then drop the original table and then re-create it as a memory table. Puis déposez le tableau original, puis re-créer la mémoire comme un tableau. Now copy all the data back from the temporary table to the original table and finally drop the temporary table. Copiez toutes les données de la table temporaire à la table d'origine et, enfin, la baisse table temporaire. While the procedure may sound complicated, it is actually a piece-of-cake to implement for any DBA, worth his salt. Bien que la procédure mai son complexe, il s'agit en fait d'un morceau de gâteau à mettre en œuvre pour tout administrateur, d'une valeur de son sel.

Here is what I used to convert a large CACHED table to MEMORY table: Voici ce que j'ai utilisé pour convertir en cache une grande table à table MEMORY:

st.execute(”CREATE CACHED TABLE TEMPSHEET(\”Meta ID\” INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY, …)”); st.execute ( "CREATE TABLE cache TEMPSHEET (\" Meta ID \ "INTEGER GÉNÉRÉS PAR DÉFAUT d'identité (DEBUT AVEC 0) NOT NULL PRIMARY KEY,…)");
st.execute(”INSERT INTO TEMPSHEET (SELECT * FROM SHEET)”); st.execute ( "INSERT INTO TEMPSHEET (SELECT * FROM FICHE)");
st.execute(”DROP TABLE SHEET”); st.execute ( "DROP TABLE FICHE");
st.execute(”CREATE MEMORY TABLE SHEET(\”Meta ID\” INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 0) NOT NULL PRIMARY KEY, … )”); st.execute ( "CREATE TABLE FEUILLE DE MEMOIRE (\" Meta ID \ "INTEGER GÉNÉRÉS PAR DÉFAUT d'identité (DEBUT AVEC 0) NOT NULL PRIMARY KEY,…)");
st.execute(”INSERT INTO SHEET (SELECT * FROM TEMPSHEET)”); st.execute ( "INSERT INTO FICHE (SELECT * FROM TEMPSHEET)");
st.execute(”DROP TABLE TEMPSHEET”); st.execute ( "DROP TABLE TEMPSHEET");
st.execute(”SHUTDOWN COMPACT”); st.execute ( "FERMETURE COMPACT");

Note: The above is excerpted from working Java code. Note: Ce qui précède est extrait de code Java de travail. The “shutdown compact” is recommended for better performance in future. Le "shutdown compact» est recommandé pour une meilleure performance à l'avenir.

Conclusion

The bottomline is that you should use HSQLDB only in Memory Table mode, instead of CACHED tables mode. Le fond est que vous devez utiliser HSQLDB seulement en mode Mémoire tableau, au lieu de tableaux en mode cache. If you need CACHED table mode due to memory limitations then you should consider a different database. Si vous avez besoin en cache mode tableau en raison de limitations de mémoire, vous devriez envisager une autre base de données.