Thanks for the suggestion, EXPLAIN PLAN seems to be the same as EXPLAIN, it 
does show me that both queries use the objectID_timestamp index.

I have now also tried to use EXPLAIN ANALYZE (did not know about that 
before) on both queries with 1.3.176 and that shows that the "in"-query has 
a much higher scancount (number of entries + 1):

SELECT
    TEST.ID,
    TEST.OBJECT_ID,
    TEST.TIMESTAMP
FROM PUBLIC.TEST
    /* PUBLIC.IDX_OBJECTID_TIMESTAMP: TIMESTAMP >= 1496268000000
        AND OBJECT_ID = 2844
        AND TIMESTAMP <= 1493589600000
     */
    /* scanCount: 1 */
WHERE (TIMESTAMP >= 1496268000000)
    AND ((OBJECT_ID = 2844)
    AND (TIMESTAMP <= 1493589600000))

-----------------------------------------------    
    
SELECT
    TEST.ID,
    TEST.OBJECT_ID,
    TEST.TIMESTAMP
FROM PUBLIC.TEST
    /* PUBLIC.IDX_OBJECTID_TIMESTAMP: TIMESTAMP >= 1496268000000
        AND OBJECT_ID IN(2844, 2845)
        AND TIMESTAMP <= 1493589600000
     */
    /* scanCount: 1973016 */
WHERE (TIMESTAMP >= 1496268000000)
    AND ((OBJECT_ID IN(2844, 2845))
    AND (TIMESTAMP <= 1493589600000))
/*
TRIP.IDX_OBJECTID_TIMESTAMP read: 23250
*/    

-- 
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 post to this group, send email to [email protected].
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