Re: [OT] Concurrent psql API

From: Csaba Nagy <nagy(at)ecircle-ag(dot)com>
To: Decibel! <decibel(at)decibel(dot)org>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Shane Ambler <pgsql(at)Sheeky(dot)Biz>, Gregory Stark <stark(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [OT] Concurrent psql API
Date: 2008-04-10 08:31:54
Message-ID: 1207816314.8259.214.camel@PCD12478
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

> I find myself doing this frequently with any long-running command,
> but currently it's a PITA because I'd doing it at the shell level and
> firing up a new psql: more work than should be necessary, and psql
> sometimes gets confused when you resume it from the background in
> interactive mode (stops echoing characters, though maybe this has
> been fixed).

I would recommend trying out the 'screen' utility (see my other post
too). And here you find a nice .screenrc too which will show you a
status bar of your active session, I find it super cool (and it's well
commented if you don't like it as it is):

http://home.insightbb.com/~bmsims1/Scripts/Screenrc.html

The man page has all commands you need, the most used by me:

Ctrl-a Ctrl-c -> open a new session;
Ctrl-a A -> name the session 8will show up with that name in the status
bar, note that the second key is a capital A not a);
Ctrl-a Ctrl-a -> switch to the last viewed session;
Ctrl-a <n> -> switch to the <n>th session, where <n> is a digit 0-9

I usually leave the screen sessions running end detach only the
terminal, and then I can connect again to the already set up sessions
using "screen -R". It's a real time saver.

It has many more facilities, and creating a new psql session is just
Ctrl-a Ctrl-c and then type in psql... and you're good to go... I don't
think you can beat that by a large margin with psql-intern commands (you
still need to type in something extra), and you do have added benefits
of clearly separated workflows and a nice overview of it.

Cheers,
Csaba.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message PFC 2008-04-10 08:58:42 Re: Free Space Map data structure
Previous Message Ashish Sharma 2008-04-10 08:27:27 Re: SQL fast in PSQL, very slow using MS.NET driver

Browse pgsql-patches by date

  From Date Subject
Next Message Gregory Stark 2008-04-10 09:02:10 Re: Concurrent psql API
Previous Message Csaba Nagy 2008-04-10 08:17:32 Re: Concurrent psql API