void readBigSetOfNumbers(int limit, int iterations, int concurrency) {
        Client client = new Client.Builder()
                .addEndpoint(endpoint)
                .setUsername(user)
                .setPassword(password)
                .setDefaultDatabase(database)
                .compressServerResponse(false)
                .compressClientRequest(false)
                .setLZ4UncompressedBufferSize(1048576)
                // when network buffer and socket buffer are the same size - it is less IO calls and more efficient
                .setSocketRcvbuf(1_000_000)
                .setClientNetworkBufferSize(1_000_000)
                .setMaxConnections(20)
                .build();
        try {
            client.ping(10); // warmup connections pool. required once per client.

            Runnable task = () -> {
                StringBuilder sb = new StringBuilder();

                for (int i = 0; i < iterations; i++) {
                    try {
                        long[] stats = doReadNumbersSet(client, limit);
                        for (long stat : stats) {
                            sb.append(stat).append(", ");
                        }
                        sb.append("\n");
                    } catch (Exception e) {
                        log.error("Failed to read dataset", e);
                    }
                }

                System.out.print(sb.toString());
            };

            System.out.println("Records, Read Time, Request Time, Server Time");
            if (concurrency == 1) {
                task.run();
            } else {
                ExecutorService executor = new ThreadPoolExecutor(concurrency, Integer.MAX_VALUE,
                        60L, TimeUnit.SECONDS,
                        new SynchronousQueue<Runnable>());

                for (int i = 0; i < concurrency; i++) {
                    executor.submit(task);
                }

                executor.shutdown();
                executor.awaitTermination(3, TimeUnit.MINUTES);
            }
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        } finally {
            client.close();
        }
    }
Reads {@code system.numbers} table into a result set of numbers of different types.
examples/client-v2/src/main/java/com/clickhouse/examples/client_v2/BigDatasetExamples.java