Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

228
Vistas
Java 8 JPA Repository Stream row-by-row in Postgresql

Reading this about MySQL defines certain query hints (@QueryHints annotation) that are required in order to make MySQL process the result set row-by-row. Does anyone know for sure what (if anything) is required for PostgreSQL?

Here is the reference query definition in the repository for MySQL:

@QueryHints(value = @QueryHint(name = HINT_FETCH_SIZE, value = "" + Integer.MIN_VALUE))
@Query(value = "select t from Todo t")
Stream<Todo> streamAll();
about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Its PostgreSQL equivalent is:

@QueryHints(value = @QueryHint(name = HINT_FETCH_SIZE, value = "1")

For contrast setFetchSize(rows) should throw SQLException when the condition rows >= 0 is not satisfied. This is not honored by MySQL's JDBC driver.

Though in PostgreSQL you can actually set up values greater than 1 to allow some caching by PostgreSQL's JDBC driver. The docs' example of 50 seems reasonable (unless you have irrationally wide rows). You could also choose this value to be a portion of the expected row count. Test a few variants before deploying your application.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda