How to get query plan information from Postgres into JDBC

后端 未结 3 1893
眼角桃花
眼角桃花 2020-12-31 23:37

I want to capture the cost numbers from the query plan you get when you \'Explain\' a query. Is there any way to get at this data inside of a Java ResultSet(or similar obje

3条回答
  •  -上瘾入骨i
    2021-01-01 00:02

    In addition to the answer supplied above, I would suggest that you make use of the ability to format EXPLAIN plans as XML in PostgreSQL 9.0 and later.

    EXPLAIN ( analyze on, format xml ) SELECT ...

    This will give you explain output you can more easily work with in Java by manipulating it as XML.

提交回复
热议问题