PostgreSQL's `cursor_tuple_fraction` GUC controls how the query planner estimates cursor usage — defaulting to 0.1, meaning it assumes only 10% of rows will be fetched. This fast-start bias favors index scans over sequential scans, which is ideal for interactive cursors that stop early but harmful when you actually read the full result set. For sessions that stream entire result sets through cursors, setting `cursor_tuple_fraction = 1.0` eliminates the bias and can dramatically improve performance. A notable gotcha: the PostgreSQL JDBC driver's chunked fetching doesn't use server-side cursors, so this parameter has no effect on JDBC behavior — `setFetchSize()` and explicit `LIMIT` clauses are the correct levers there.
246 Impressions