Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I run an "explain analyze" on a query using JOOQ?

Can I run explain analyze on a query in JOOQ? like:

explain analyse select some, columns from some_table

but do it using JOOQ on PostgreSQL database?

I have found an interface org.jooq.Explain, with a method DSLContext.explain​(Query query) - but it seems just to use EXPLAIN on a query:

@Support({AURORA_MYSQL,AURORA_POSTGRES,H2,HSQLDB,MARIADB,MEMSQL,MYSQL,ORACLE,POSTGRES,SQLITE}) 
Explain explain​(Query query)
Run an EXPLAIN statement in the database to estimate the cardinality of the query.

Is there any sensible way to run an EXPLAIN ANALYZE on the database from the code side?

like image 239
dziki Avatar asked Oct 27 '25 14:10

dziki


1 Answers

It's not supported yet: https://github.com/jOOQ/jOOQ/issues/10424. Use plain SQL templating, instead:

ctx.fetch("explain analyze {0}", select);
like image 181
Lukas Eder Avatar answered Oct 30 '25 05:10

Lukas Eder



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!