getPlanSQL response

18 views
Skip to first unread message

Ronit

unread,
Aug 3, 2022, 2:10:40 AMAug 3
to H2 Database
Hello ,

Is there a chance for  Prepared.getPlanSQL(1) to return empty string or null or exception ?
For now I am getting 

SELECT
    "_0".TIME_SPENT,
    "_1".SUBJECT_PK
FROM (
    SELECT
        "C_TIMESPENT" AS "TIME_SPENT"
    FROM "INSTITUTE"."COURCES"
) "_0"


This is the result after the migration of H2 to the latest version, in H2-1.3.176 
it was 

SELECT
    _0.TIME_SPENT,
    _1.
SUBJECT_PK
FROM (
    SELECT
        C_TIMESPENT AS TIME_SPENT
    FROM INSTITUTE.COURCES
        /*  INSTITUTE  . COURCES  .tableScan */
) _0
    /* SELECT
        C_TIMESPENT AS TIME_SPENT
    FROM  INSTITUTE  . COURCES
        /++  INSTITUTE  . COURCES  .tableScan ++/
     */
    /* WHERE TIME_SPENT IN(
        SELECT
            C_TIMESPENT
        FROM  INSTITUTE  . COURCES
            /++  INSTITUTE  . COURCES  .tableScan ++/
        )

    */


Thanks and Regards
R. Joshi

Evgenij Ryazanov

unread,
Aug 3, 2022, 2:19:03 AMAug 3
to H2 Database
Hello.

org.h2.command.Prepared is not a part of API and it should never be used directly by application.

If you need to get execution plan of some query or DML command, you should use the EXPLAIN command:
Reply all
Reply to author
Forward
0 new messages