Take the 2-minute tour ×
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. It's 100% free, no registration required.

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
add comment

2 Answers

up vote 4 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:

PAGER=/usr/bin/less

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

share|improve this answer
1  
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
add comment

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:

LESS="-X"
export LESS
share|improve this answer
add comment

Your Answer

 
discard

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.