Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Rows Per Page suggestion #16
The table preview (viewing paginated records of a table after clicking it) is an excellent idea, but is taking a long time for a large database (10M rows in my case).
Suggestion: use LIMIT in the query, and the Preferences 'Rows per page' as the value.
Could reduce execution time 1000x (17.8s - 22ms in this example):
I'm not sure why loading the records in the table view is so slow. It actually uses a LIMIT clause. However, it always orders the results (either by primary key, or by ctid if no key is available). This is necessary because otherwise going to the next page might show the same records again!
To determine why the query is slow, you can open a second connection to the server (open a new window, or use psql) and execute the following query:
SELECT * FROM pg_stat_activity
This will show you the exact query Postico uses to load the table. Then you can use the EXPLAIN ANYLYZE command to determine why it is so slow, and we could check if there are ways to improve query speed.
However, I'm not sure if there's a general way I can make the table view faster.
Ah, yea it seems ordering would be the culprit, which would be necessary for pagination, hmmm...
Personally, I would use the 'table view' to get a preview of the tables (to get relations and some sample data, limited to 100 random samples for example), and use this to build queries in the SQL Query module, sorting there as necessary. One solution might be to default as 'preview' (disable pagination) for large tables and allow pagination for smaller?
@qwesda - This table is from geonames, downloadable here as 'allCountries.zip': http://download.geonames.org/export/dump/
@corgus I've added a new preference to Postico: "Always sort tables".
If you disable this checkbox, Postico will no longer sort rows by default (unless you click the table header). You can still click through pages, but PostgreSQL might decide to show some records it already showed on the previous page as the order might change from query to query.
Could you try if this improves performance for your database? The new setting is available in this build: Postico 2015-08-04