4 ms·
That's cute but, let's be honest, viewing query results for anything but trivial schemas or amounts of data with psql is somewhat close to impractical.
by dinkumthinkum 14y ago
That's cute but, let's be honest, viewing query results for anything but trivial schemas or amounts of data with psql is somewhat close to impractical.
- Roboprog 14y agoDump the result set as a table into a file and refresh "the file" in a browser? Having 2 windows open is about the same as having 2 panels in one of the DB "Monties". http://catb.org/jargon/html/M/monty.html http://catb.org/jargon/html/M/monty.html
- Roboprog 14y agoThat said, the sql*pro CLI that Oracle provides for their DB SUCKS (!!!) rotten eggs, and gives people the impression that a CLI is useless for database work.
- sehrope 14y agoYes the CLI for sql*plus does suck. When I am using it (pretty rare these days) I use rlwrap to make it suck less. Command history is pretty convenient too. Here's my ~/bin/sqlplus shell script pointing to the Oracle instant client install: #!/bin/sh OIC_DIR=$HOME/opt/oracle-instant-client export LD_LIBRARY_PATH="${OIC_DIR}:$LD_LIBRARY_PATH" export TNS_ADMIN="${OIC_DIR}" rlwrap "${OIC_DIR}/sqlplus" "$@" Bonus: You can use a tnsnames.ora file with the instant client if you put it in the instant client directory and export the environment variable in the script above.
- Roboprog 14y agoThat's right, it's been a while. "pro" was the C preprocessor, "plus" was the gawdhawful CLI. Thanks for the tip on rlwrap, in case I have to use that thing again. I'm assuming it provides GNU readline support on top of the base tool.
- mickeyp 14y agoEven if you're not an Emacs guy you may want to consider using it with the sqlplus.el module. It adds a nice table formatter and other features to make SQL*Plus more palatable.
- sehrope 14y agoYes, rlwrap provides GNU readline atop just about anything. When I write my REPL tools (test utilities, etc) I usually wrap them for local use in rlwrap as 99% of the time it's what you want.
- papsosouid 14y agoWhile you are being honest, can you also be specific? I have large, fully normalized schemas which I have only ever viewed via psql. I run queries returning lots of data all the time. I have no idea what part of this is supposed to be impractical.
- smilliken 14y agoOn the contrary, it can be very efficient when you become familiar with psql. psql + tmux (or your favorite terminal multiplexer) means you can have as many interactive sessions open as you like, and you don't need to leave your keyboard.
- Gravityloss 14y agoThat's why you aggregate, section, order, limit and use all the commands to reduce what you are looking for to something that fits on the screen. You can't "view" a billion rows straight in any meaningful way at once anyway, no matter what your client. Most of the time you're interested in some summary statistic. Graphics are often summary statistics as well. I've found it to be quite good, you can express powerful stuff with the keyboard directly, once you know what you're doing. A GUI is always less versatile in forming joins and search criteria. Once you start having a dropdown query builder, what's the point? I do use a separate editor often, nano or sublime, depending if I'm working on the remote or local end. Both have syntax highlight, and then it's the natural path to scripts and version control from that.