Query
Issuing SQL, processing results, calling stored procedures, escape syntax, server-prepared statements, cursor-based fetching, and multithreaded use of the driver.
For PostgreSQL-specific query features (LISTEN/NOTIFY, COPY,
replication) see PostgreSQL features
.
- Issuing a query
Issuing SQL through
StatementandPreparedStatement, iterating the returnedResultSet, and the small set of pgJDBC-specific things to know about updates, DDL, and try-with-resources cleanup. - Server-prepared statements
How pgJDBC promotes a
PreparedStatementto a server-prepared plan: theprepareThresholdcounter, when binary transfer kicks in, the per-statement override, and howautosaveandflushCacheOnDdlinteract with cached plans. - JDBC escape syntax
The vendor-portable JDBC escape sequences the driver translates into native PostgreSQL:
{call ...}for stored objects,{d}/{t}/{ts}literals, scalar functions,{escape}, and outer-join forms. - Stored functions and procedures
Calling PostgreSQL functions and procedures from JDBC through
CallableStatementand the{call ...}escape, including theescapeSyntaxCallModeproperty that picks betweenSELECT-style and v11+CALL-style translation. - Cursor-based fetching
Streaming large result sets row-by-row instead of buffering everything:
Statement.setFetchSize(n)opens a server-side cursor, the auto-commit-must-be-off requirement, and the per-batch network behaviour. - Batch INSERT rewriting How reWriteBatchedInserts collapses N single-row INSERTs into a multi-row INSERT, the precise conditions the rewriter looks for, the power-of-two grouping that determines what executeBatch() returns, and the pg_stat_statements trade-off.