When I do psql --no-align --field-separator ','
, I get CSV output with a header containing field names and a trailer telling me how many rows were found. To pass that into an analysis program, I need the header but not the trailer. I can surely write a filter to pass the first N-1 lines of the psql output but I'd prefer to suppress the trailer. Is there an option I'm missing that will turn on the header with --tuples-only
or turn off the trailer?
The basic SQL standard query to count the rows in a table is: SELECT count(*) FROM table_name; This can be rather slow because PostgreSQL has to check visibility for all rows, due to the MVCC model.
A tuple is PostgreSQL's internal representation of a row in a table. A single row may have many tuples representing it, but only one of these tuples will be applicable at any single point in time.
psql --no-align --field-separator ',' --pset footer
will turn off the row summary footer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With