-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

PostgreSQL 10 High Performance
By :

Many performance issues come from bad designs or implementations that just don't fundamentally work well with PostgreSQL. There are a few areas where the problem is not so bad; it's more of a quirk with known workarounds. This section covers some of the more common problems new PostgreSQL users run into from this category.
It's not unusual to find an application that does the following to determine how many rows there are in a table:
SELECT count(*) FROM t;
In some databases other than PostgreSQL, this executes very quickly, usually because that information is kept handy in an index or similar structure. Unfortunately, because PostgreSQL keeps its row visibility information in the row data pages, you cannot determine a true row count without looking at every row in the table, one at a time, to determine whether they are visible or not. That's a sequential scan of the full table, and it's pretty slow; it even turns out to be an effective way to benchmark...