Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

jdbc:hive2://<host>:<port>/<db>;fetchsize=<value>


Info
titleFetch Size DetailsHive Version 4.0

The Hive JDBC driver will receive a preferred fetch size from the instance of HiveServer2 it has connected to.  This value is specified on the server by the hive.server2.thrift.resultset.default.fetch.size configuration.

The JDBC fetch size is only a hint and the server will attempt to respect the client's requested fetch size though with some limits.  HiveServer2 will cap all requests at a maximum value specified by the hive.server2.thrift.resultset.max.fetch.size configuration value regardless of the client's requested fetch size.

While a larger fetch size may limit the number of round-trips between the client and server, it does so at the expense of additional memory requirements on the client and server.

The default JDBC fetch size value may be overwritten, per statement, with the JDBC API:

  • Setting a value of 0 instructs the driver to use the fetch size value preferred by the server
  • Setting a value greater than zero will instruct the driver to fetch that many rows, though the actual number of rows returned may be capped by the server
  • If no fetch size value is explicitly set on the JDBC driver's statement then the driver's default value is used
    • If the fetch size value is specified within the JDBC connection string, this is the default value
    • If the fetch size value is absent from the JDBC connection string, the server's preferred fetch size is used as the default value

...