Skip to content

Instantly share code, notes, and snippets.

@Weiyuan-Lane
Last active June 10, 2021 17:58
Show Gist options
  • Save Weiyuan-Lane/c98b0ebefb139d6badfdfe6d4d2cfd79 to your computer and use it in GitHub Desktop.
Save Weiyuan-Lane/c98b0ebefb139d6badfdfe6d4d2cfd79 to your computer and use it in GitHub Desktop.
Comparing PgHero, and Cloud Sql's Query Insights

In the following, we compare the features of PgHero against Cloud SQL with Query Insights. They will be scored up to three ticks each. The comments will justify the decision, but give you the opportunity to reassess on your own terms.

Feature PgHero Cloud SQL + Query Insights Addn. comments
Disk Space monitoring ✅ ✅ ✅ ✅ In PgHero, you can monitor the current disk space of each tables and index. It will also advise the user on unused indexes.

In Query Insights and Cloud SQL, you can't view the breakdown and receive recommendations, but Cloud SQL features a dashboard with a 30 day time record of disk space, which can be a plus for tracking across time.
Connection monitoring ✅ ✅ ✅ ✅ In PgHero, you can monitor the current connections by database and user.

In Cloud SQL, you can monitor the database connections across the last 30 days.
Data Retention ✅ ✅ ✅ Query Insights' data retention is reliant on Cloud Monitoring, which is 6 weeks as of 31st May 2021.

For PgHero, most data displayed is of current time with little to no retention of past data. The exception is for the aggregated queries data, which depends on when you reset the past information with pg_stat_statements_reset().
Security ✅ ✅ ✅ ✅ ✅ Identity-Aware Proxy (IAP) can be set up with PgHero to control access to the application.

On the other hand, Query Insights can utilize Identity and Access Management (IAM) to perform access control. In addition, it also provides encryption for its metrics, by default.
Setup Time ✅ ✅ ✅ To setup PgHero in Google Cloud with Access Control, a certain level of context as well as effort is required to set it up.

For Query Insights, setup only requires a simple click of a checkbox, with access control using IAM.
Cost ✅ ✅ For Query Insights, there is no additional pricing for enabling this enhanced feature. However, there will be associated costs to Cloud Monitoring, albeit expectedly on the low side.

In the simplest setup of PgHero in a serverless environment, the cost of using multiple tools will need to be factored in, though it would be a static cost that doesn't scale with database usage of your application.
Query plan ✅ ✅ ✅ ✅ In PgHero, it features a dashboard which contains all queries that can be sorted by total time, average time per query, and number of calls. You can run EXPLAIN ANALYZE directly from PgHero to get a breakdown of the query.

For Query Insights, it provides the same sort fields. In addition, it has a much-better-to-view query plan. The only issue here seems to be that for the query plan to be viewable, the data point must first be created, which may take some time.
Platform dependent ✅ ✅ ✅ As the name suggests, Query Insights is only available to Google Cloud, unlike PgHero which can be hosted anywhere.

In most of the above, we should note that in Cloud SQL with Query Insights, it usually offers a 30 day time chart for each of its metrics, unlike PgHero which mostly gives the current statistics (with no time component). This gives an additional advantage for Cloud SQL with Query Insights

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment