This is the output of EXPLAIN ANALYZE for me:

EXPLAIN ANALYZE
SELECT MAX(b.id) as id
FROM tbl_b b
JOIN tbl_a a ON b.tbl_a_id = a.id
GROUP BY b.tbl_a_id
HAVING a.active = true;
PLAN
SELECT
    MAX(B.ID) AS ID
FROM PUBLIC.TBL_A A
    /* PUBLIC.TBL_A.tableScan */
    /* scanCount: 101 */
INNER JOIN PUBLIC.TBL_B B
    /* PUBLIC.TBL_B_UK_INDEX_4: TBL_A_ID = A.ID */
    ON 1=1
    /* scanCount: 50099 */
WHERE B.TBL_A_ID = A.ID
GROUP BY B.TBL_A_ID
HAVING A.ACTIVE = TRUE
/*
total: 892
TBL_B.TBL_B_DATA read: 614 (68%)
TBL_B.TBL_B_UK_INDEX_4 read: 278 (31%)
*/
(1 row, 229 ms)



EXPLAIN ANALYZE
SELECT MAX(b.id) as id
FROM tbl_b b
JOIN tbl_a a ON b.tbl_a_id = a.id
GROUP BY b.tbl_a_id
HAVING a.active = true;
PLAN
SELECT
    MAX(B.ID) AS ID
FROM PUBLIC.TBL_A A
    /* PUBLIC.TBL_A.tableScan */
    /* scanCount: 101 */
INNER JOIN PUBLIC.TBL_B B
    /* PUBLIC.TBL_B_IDX: TBL_A_ID = A.ID */
    ON 1=1
    /* scanCount: 50099 */
WHERE B.TBL_A_ID = A.ID
GROUP BY B.TBL_A_ID
HAVING A.ACTIVE = TRUE
/*
TBL_B.TBL_B_IDX read: 46
*/
(1 row, 25 ms)

--
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 h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to