Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm connected remotly to my database server with cygwin in full screen.

When I query my database with

   select id, name from table limit 27;

I get 27 records and I can do a new query seeing the result of the previous query.

But, If I replace 27 by 28, I see 28 records in one screen with an (End) in reverse video. If I want to do a new query, I have to press q.

I can't see the result of the previous query even if I use the scrollbar of my cygwin window.

Which option do I have to modify to increase this buffer ?

My psql client and database server version is 9.1.4 and they are installed on Ubuntu 12.04

share|improve this question
up vote 5 down vote accepted

You can turn off (and on) the paging in psql:

\pset pager [on|off]

If you don't specify on or off, the command will toggle the setting. (More on \pset in the documentation.) In the shell, you can even set the pager you want to use:


If you start psql after this, less will be your pager.

share|improve this answer
Thank you. FYI, if you want to use it with psql -c "sql query", you have to add "-P pager=off" Then you would have psql -P pager=off -c query – Luc M Aug 1 '12 at 13:43

Assuming less is used as the pager, you can turn off this screen-clearing feature which indeed is annoying within psql. Use the -X option:

  -X or --no-init
          Disables sending the termcap initialization and deinitialization
          strings to the terminal.  This is  sometimes  desirable  if  the
          deinitialization  string does something unnecessary, like clear‐
          ing the screen.

The option can be set as an environment variable in your $HOME/.profile init file:

export LESS
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.