Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>- View the extreme values of a result set? I.e. I run a query which returns 200 results, and I want to look at the first few and the last few. (PMA: home and end. CLI: scroll?)

SELECT TOP ORDER BY ?



You mean, run the (possibly expensive) query twice with different sort orders, and not see the middle ones at all?

If that is what you mean, I think the advantage remains with PMA.

Edit to clarify: I'm thinking here in terms of data exploration. I want to look at the whole result set, but the most interesting ones are likely to be at the top and bottom. With PMA, I can get the whole result set, and nothing else, on a single page. So I just scroll to the top or bottom of the page to see the extreme values.

With a CLI, it can be difficult to find where the output of that specific query started. (This is a trade-off, because the CLI allows you to see results from your previous queries.)

If there was a CLI feature like 'view the previous result set in less, without re-running it', I think that would satisfy me on this point. If you have to re-run it, that's less good, but it would beat scrolling.


If a default pager isn't set for you, you could set it. http://stackoverflow.com/questions/14474138/customize-pager-...


Thank you! This is a pretty good solution, and it turns out it exists in mysql too. (`pager less`)


> You mean, run the (possibly expensive) query twice with different sort orders, and not see the middle ones at all?

Or run it once into a temporary table, and then query the temporary table however you want to get subsets of interest. Which, if you are doing data exploration on the potentially large results of a potentially expensive query, is probably what you should be doing, no matter what tool you are using. Because it lets you do a lot more than just check the top and bottom easily.



I'm not a DB/pg guy but I think you want SELECT INTO TEMP which will create a temp table from your query (gets dropped at the end of the session).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: