HSQLDB Cached Table Versus Memory Table Performance & Conversion HSQLDB versus memória cache tabela tabela & Performance conversão
In short in HSQLDB cached table sucks in terms of performance. Em suma, em HSQLDB cache sucks mesa em termos de desempenho. To elaborate I was running a program which takes around 9 hours running on two medium sized cached tables (bigger one 163 MB). Eu estava correndo para elaborar um programa que leva cerca de 9 horas rodando em dois quadros médios em cache (uma maior 163 MB). I changed the tables to memory tables (default) and it now takes less than 10 minutes. Eu mudei os quadros para a memória mesas (padrão) e que agora leva menos de 10 minutos. Let's see how we can easily convert memory table to cached table and vice-versa. Vamos ver como podemos facilmente converter a tabela de memória cache tabela e vice-versa.
How can you convert a HSQLDB Memory Table to Cached Table? Como você pode converter um quadro para HSQLDB Memória cache quadro?
This one is easy. Esta é uma tarefa fácil. I just open the script file and change the word memory to cached in the create table statement. Acabei de abrir o arquivo script e alterar a palavra a memória cache na tabela criar declaração. It automatically converts it to cached table next time it is used. Trata-se converte automaticamente a tabela em cache próxima vez que for usado. The reverse is however more complex. O verso é, no entanto, mais complexa.
How can you convert a HSQLDB CACHED Table to MEMORY Table? Como você pode converter um quadro para a memória cache HSQLDB quadro?
You need to create a temporary table and copy all the data (preferably using insert into … select * from … query) to that table. Você precisa criar uma tabela temporária e copiar todos os dados (de preferência usando inserir em…… selecione * a partir de consulta) que a tabela. Then drop the original table and then re-create it as a memory table. Em seguida, solte a tabela original e, em seguida, voltar a criá-la como uma memória tabela. Now copy all the data back from the temporary table to the original table and finally drop the temporary table. Agora copiar todos os dados de volta a partir da tabela temporária para a tabela original e, finalmente soltar a tabela temporária. While the procedure may sound complicated, it is actually a piece-of-cake to implement for any DBA, worth his salt. Embora o processo pode parecer complicado, na realidade, é um pedaço de bolo para a execução de qualquer DBA, vale o seu sal.
Here is what I used to convert a large CACHED table to MEMORY table: Aqui está o que eu utilizado para converter uma grande mesa para a memória cache tabela:
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 TEMPSHEET em cache (\" Meta ID \ "INTEGER GERADOS POR padrão como identidade (começam com 0) NOT NULL PRIMARY KEY, ...)");
st.execute("INSERT INTO TEMPSHEET (SELECT * FROM SHEET)"); st.execute ( "INSERT INTO TEMPSHEET (SELECT * FROM FICHA)");
st.execute("DROP TABLE SHEET"); st.execute ( "DROP TABLE FICHA");
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 FICHA DE MEMÓRIA (\" Meta ID \ "INTEGER GERADOS POR padrão como identidade (começam com 0) NOT NULL PRIMARY KEY, ...)");
st.execute("INSERT INTO SHEET (SELECT * FROM TEMPSHEET)"); st.execute ( "INSERT INTO FOLHA (SELECT * FROM TEMPSHEET)");
st.execute("DROP TABLE TEMPSHEET"); st.execute ( "DROP TABLE TEMPSHEET");
st.execute("SHUTDOWN COMPACT"); st.execute ( "SHUTDOWN COMPACT");
Note: The above is excerpted from working Java code. Nota: O trabalho acima é excerpted de código Java. The "shutdown compact" is recommended for better performance in future. O "shutdown compacto" é recomendado para um melhor desempenho no futuro.
Conclusion Conclusão
The bottomline is that you should use HSQLDB only in Memory Table mode, instead of CACHED tables mode. O bottomline é que você deve usar somente na memória HSQLDB Quadro modo, em vez de tabelas em cache mode. If you need CACHED table mode due to memory limitations then you should consider a different database. Se você precisa de mesa em cache modo devido a limitações de memória, então você deve considerar uma base de dados diferente.
Filed under Arquivado em HSQLDB , Headline News Headline News , How To How To , Java Software Java Software , Open Source Software Open Source Software , Programming Programação | |
| |
RSS 2.0 RSS 2,0 | |
Trackback this Article | este artigo |
Email this Article E-mail este artigo
You may also like to read Você pode também gosta de ler |





































September 12th, 2007 at 4:12 pm 12 de setembro de 2007 em 4:12 pm
You can convert from CACHED tables to MEMORY tables using the same method of modifying the .script file. Você pode converter tabelas para a memória cache de tabelas utilizando o mesmo método de modificar o. Script arquivo.
Before modification, you need to open the database with a client and issue the “SHUTDOWN SCRIPT” command. Antes da modificação, você precisa de abrir o banco de dados com um cliente e emitir o "SHUTDOWN SCRIPT" comando. The .script file will then contain all the data for the CACHED tables, as well as MEMORY tables. A. Script arquivo conterá então todos os dados para o cache quadros, bem como MEMORY tabelas. You can then change the word MEMORY to CACHED in the .script before opening the database again. Em seguida, você pode alterar a palavra na memória para cache. Script antes de abrir o banco de dados novamente.