Issue
When you view your team usage page, it shows you an unexpected value for "Heroku Connect rows synced" and you want to understand how this number is calculated.
Resolution
This number is the total number of rows being kept in sync across all of your connections, including connections to both production and sandbox organizations. Even if your objects don't see many updates throughout a month, the number will be the sum of the number of rows across all tables.
You can verify these numbers by issuing COUNT(*)
queries against your mapped tables, e.g.,
-- Find the number of synchronized rows in the Connection with schema "salesforce" and table "account"
SELECT
COUNT(*)
FROM
salesforce.account
;
This process could be labor intensive though, so to get an estimate one could do something like:
SELECT
SUM(reltuples::BIGINT) as approximate_usage
FROM
pg_class
WHERE
relname IN (
SELECT
CONCAT(table_schema, '.', table_name) as fq_name
FROM
information_schema.tables
WHERE
table_schema = 'salesforce'
AND
-- ignore Connect system tables
table_name NOT LIKE '\_%'
)
OR
relname IN (
SELECT
table_name
FROM
information_schema.tables
WHERE
table_schema = 'salesforce'
AND
table_name NOT LIKE '\_%'
)
;
It's important to note that even if your current usage exceeds the amount granted by your license or contract, you'll still be able to use Heroku Connect normally. (See: What happens if I exceed my row limit on Heroku Connect?)