慢查询内连接多个表HSQLDB

时间:2016-07-18 14:22:05

标签: performance hsqldb

我在我的java web应用程序中使用hsqldb作为我的嵌入式数据库我必须使用此查询从HSQLDB提供数据,有没有办法更好地执行此查询?

SELECT  RU.c AS Title, RU.g AS FullCode, RU.id AS RUAccountID,RU.i AS Published, RU.b AS RUAccountCode, 
    PC.id AS PCID,SL.id AS SLAccountID, SL.a AS gl_id,GL.a AS at_id
           from GLBL_PC AS PC
             INNER JOIN  FINC_RU AS RU ON RU.F = PC.ID
             INNER JOIN  FINC_SL AS SL ON SL.ID = RU.A
             INNER JOIN  FINC_GL AS GL ON GL.ID = SL.A
           WHERE RU.e=1 AND RU.a=6
           ORDER BY  RU.b;

1 个答案:

答案 0 :(得分:1)

切换列表中的GBL-PC和FINC_RU表。

如果FINC_RU表很大,则可以在FINC_RU(A,E)上创建索引以加快速度。

每个ID列应具有PRIMARY KEY约束或索引。