Does PostGresSQL have this feature?

Started by Nonameabout 25 years ago6 messagesgeneral
Jump to latest
#1Noname
martin.chantler@convergys.com

I am wondering if a very useful feature of some DB's is available in
postgres

For example in DB2 you can execute SQL from the command line (via terminal
emulator)
It will perform it entirely then display the results, but only one page at
a time
You can then page down and page up within the results (or scroll across)

I notice that PSQL doesn't do this which makes large tables difficult to
maintain
Of course you could put a decent Where clause in but in the real world most
people
like to narrow things down to a certain point then scroll around a few
hundred records
looking for the data by hand. Currently this doesn't seem to be possible

The only way I can think of doing this is to write a program in C (or use
ODBC/JDBC) to
perform the SQL then retrieve x records and display them and allows paging
to be performed
When paging down the current set would be cached so that page up's would be
possible

Doing this in VB would be easy and you could allow data to be editted to...

NB Unfortunately MS Access is no good because it tries to load ALL the data
in one go and
you CANT get out of it!!!

Anyone got any better ideas???

Martin C.

--

NOTICE: The information contained in this electronic mail transmission is
intended by Convergys Corporation for the use of the named individual or
entity to which it is directed and may contain information that is
privileged or otherwise confidential. If you have received this electronic
mail transmission in error, please delete it from your system without
copying or forwarding it, and notify the sender of the error by reply email
or by telephone (collect), so that the sender's address records can be
corrected.

#2Dominic J. Eidson
sauron@the-infinite.org
In reply to: Noname (#1)
Re: Does PostGresSQL have this feature?

On Tue, 27 Feb 2001 martin.chantler@convergys.com wrote:

I notice that PSQL doesn't do this which makes large tables difficult to
maintain

This is already implemented in psql - you have to make sure your PAGER
environment variable is set correctly - there might be some other
requirements that I'm not familiar with, but just 5 minutes ago, I paged
around in a 39k row table using "less" ...

--
Dominic J. Eidson
"Baruk Khazad! Khazad ai-menu!" - Gimli
-------------------------------------------------------------------------------
http://www.the-infinite.org/ http://www.the-infinite.org/~dominic/

#3Poul L. Christiansen
poulc@cs.auc.dk
In reply to: Noname (#1)
Re: Does PostGresSQL have this feature?

In PostgreSQL you can (almost) do this.

When i terminal mode logged in as user postgres use these commands:
1. "psql MyDatabase" to log into the database.
2. "select * from MyVeryBigTable"
3. Press space to view a page at the time.

I think you can enter regular expressions, instead of pressing space to
see the next page. But I don't know how to scroll up within the results.
Does anybody know if this is possible?

I'd suggest you browse the utilities in www.greatbridge.org - there
might be some smart tool to manage large tables.

Poul L. Christiansen

martin.chantler@convergys.com wrote:

Show quoted text

I am wondering if a very useful feature of some DB's is available in
postgres

For example in DB2 you can execute SQL from the command line (via terminal
emulator)
It will perform it entirely then display the results, but only one page at
a time
You can then page down and page up within the results (or scroll across)

I notice that PSQL doesn't do this which makes large tables difficult to
maintain
Of course you could put a decent Where clause in but in the real world most
people
like to narrow things down to a certain point then scroll around a few
hundred records
looking for the data by hand. Currently this doesn't seem to be possible

The only way I can think of doing this is to write a program in C (or use
ODBC/JDBC) to
perform the SQL then retrieve x records and display them and allows paging
to be performed
When paging down the current set would be cached so that page up's would be
possible

Doing this in VB would be easy and you could allow data to be editted to...

NB Unfortunately MS Access is no good because it tries to load ALL the data
in one go and
you CANT get out of it!!!

Anyone got any better ideas???

Martin C.

--

NOTICE: The information contained in this electronic mail transmission is
intended by Convergys Corporation for the use of the named individual or
entity to which it is directed and may contain information that is
privileged or otherwise confidential. If you have received this electronic
mail transmission in error, please delete it from your system without
copying or forwarding it, and notify the sender of the error by reply email
or by telephone (collect), so that the sender's address records can be
corrected.

#4Peter Eisentraut
peter_e@gmx.net
In reply to: Noname (#1)
Re: Does PostGresSQL have this feature?

martin.chantler@convergys.com writes:

For example in DB2 you can execute SQL from the command line (via terminal
emulator)
It will perform it entirely then display the results, but only one page at
a time
You can then page down and page up within the results (or scroll across)

I notice that PSQL doesn't do this which makes large tables difficult to
maintain

As another poster correctly guessed, you need to set the PAGER environment
variable to 'less'. The default pager is 'more', which is less
sophisticated, but it is the standard, more or less. (Pun not intended,
but tolerated.)

--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/

#5Norman J. Clarke
norman@combimatrix.com
In reply to: Noname (#1)
Re: Does PostGresSQL have this feature?

Martin,

What platform are you running psql on? On Unix all you have to do is set
your shell environment variable PAGER (PAGER=more or PAGER=less) and psql
will then do what you want. If you're running it on Windows, though, I'm
not sure what to suggest. If your postgresql installation is running on a
Unix server, you might telnet to that machine and run psql from there.

Norm

--------------------------------------
Norman Clarke
Combimatrix Corp Software Development
Harbour Pointe Tech Center
6500 Harbour Heights Pkwy, Suite 301
Mukilteo, WA 98275

tel: 425.493.2240
fax: 425.493.2010
--------------------------------------

On Tue, 27 Feb 2001 martin.chantler@convergys.com wrote:

Show quoted text

I am wondering if a very useful feature of some DB's is available in
postgres

For example in DB2 you can execute SQL from the command line (via terminal
emulator)
It will perform it entirely then display the results, but only one page at
a time
You can then page down and page up within the results (or scroll across)

I notice that PSQL doesn't do this which makes large tables difficult to
maintain
Of course you could put a decent Where clause in but in the real world most
people
like to narrow things down to a certain point then scroll around a few
hundred records
looking for the data by hand. Currently this doesn't seem to be possible

The only way I can think of doing this is to write a program in C (or use
ODBC/JDBC) to
perform the SQL then retrieve x records and display them and allows paging
to be performed
When paging down the current set would be cached so that page up's would be
possible

Doing this in VB would be easy and you could allow data to be editted to...

NB Unfortunately MS Access is no good because it tries to load ALL the data
in one go and
you CANT get out of it!!!

Anyone got any better ideas???

Martin C.

#6Jeff MacDonald
jeff@pgsql.com
In reply to: Norman J. Clarke (#5)
Re: Does PostGresSQL have this feature?

when i read "command line" i took it as the unix commmand line, in which case
you can do something like this

psql -c "SELECT * FROM tablename" databasename | less

or , like others said, if PAGER is set properly, you can leave off the |less

jeff

On Tue, 27 Feb 2001, Norman J. Clarke wrote:

Martin,

What platform are you running psql on? On Unix all you have to do is set
your shell environment variable PAGER (PAGER=more or PAGER=less) and psql
will then do what you want. If you're running it on Windows, though, I'm
not sure what to suggest. If your postgresql installation is running on a
Unix server, you might telnet to that machine and run psql from there.

Norm

--------------------------------------
Norman Clarke
Combimatrix Corp Software Development
Harbour Pointe Tech Center
6500 Harbour Heights Pkwy, Suite 301
Mukilteo, WA 98275

tel: 425.493.2240
fax: 425.493.2010
--------------------------------------

On Tue, 27 Feb 2001 martin.chantler@convergys.com wrote:

I am wondering if a very useful feature of some DB's is available in
postgres

For example in DB2 you can execute SQL from the command line (via terminal
emulator)
It will perform it entirely then display the results, but only one page at
a time
You can then page down and page up within the results (or scroll across)

I notice that PSQL doesn't do this which makes large tables difficult to
maintain
Of course you could put a decent Where clause in but in the real world most
people
like to narrow things down to a certain point then scroll around a few
hundred records
looking for the data by hand. Currently this doesn't seem to be possible

The only way I can think of doing this is to write a program in C (or use
ODBC/JDBC) to
perform the SQL then retrieve x records and display them and allows paging
to be performed
When paging down the current set would be cached so that page up's would be
possible

Doing this in VB would be easy and you could allow data to be editted to...

NB Unfortunately MS Access is no good because it tries to load ALL the data
in one go and
you CANT get out of it!!!

Anyone got any better ideas???

Martin C.

Jeff MacDonald,

-----------------------------------------------------
PostgreSQL Inc | Hub.Org Networking Services
jeff@pgsql.com | jeff@hub.org
www.pgsql.com | www.hub.org
1-902-542-0713 | 1-902-542-3657
-----------------------------------------------------
Facsimile : 1 902 542 5386
IRC Nick : bignose
PGP Public Key : http://bignose.hub.org/public.txt