ARTICLE AD BOX
Im building a PostgreSQL CLI client in Go (pgxcli), inspired by pgcli. I am using the pgx driver, and the app features an REPL, autocompletion, and syntax highlighting.
Currently, the code buffers the entire result set in memory, but this becomes inefficient with large tables (millions of rows). Im considering using cursors to stream results, but I run into two problems:
I won’t know the number of rows in advance.
The row widths vary, making it difficult to render an ASCII table.
I’m streaming to pagers like less and more. How can I manage this without buffering the entire results, especially with dynamic row sizes? Also, I noticed pgcli has a query limit—could that be part of the solution, or is there a better approach?
Any guidance or tips would be thankful!
