Hello! WHERE boolean and WHERE boolean = TRUE have no difference.
The actual problem is usage of OR, H2 is unable to use indexes in such conditions. Take a look on execution plan produced by the EXPLAIN <https://h2database.com/html/commands.html#explain> command: SELECT "SEQUENCE", "MEM", "MEMADDR", "MEMVALUE", "MEMREAD" FROM "PUBLIC"."DATA" /* PUBLIC.DATA.tableScan */ WHERE "MEM" OR "IRQREQUEST" ORDER BY 1 So you need to convert this query into query with a UNION: (select sequence, mem, memaddr, memvalue, memRead from data where mem union select sequence, mem, memaddr, memvalue, memRead from data where irqRequest) order by sequence; This query can use indexes, see its execution plan: (SELECT "SEQUENCE", "MEM", "MEMADDR", "MEMVALUE", "MEMREAD" FROM "PUBLIC"."DATA" /* PUBLIC.MEM: MEM = TRUE */ WHERE "MEM") UNION (SELECT "SEQUENCE", "MEM", "MEMADDR", "MEMVALUE", "MEMREAD" FROM "PUBLIC"."DATA" /* PUBLIC.IRQREQUEST: IRQREQUEST = TRUE */ WHERE "IRQREQUEST") ORDER BY 1 -- 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 on the web visit https://groups.google.com/d/msgid/h2-database/46d20b0f-f1c0-473a-b1d9-2993c0d8b1f2n%40googlegroups.com.
