Skip to content

Commit

Permalink
chore: update base table in the query
Browse files Browse the repository at this point in the history
  • Loading branch information
njuguna-n committed Nov 6, 2024
1 parent 22e3c34 commit c878ec0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions content/en/hosting/analytics/building-dbt-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,10 @@ kubectl exec -it postgres-pod-name -- psql -U postgres -c "SELECT pg_size_pretty

To get the percentage of documents that have synced you can run the following query in your Postgres database:
```sql
SELECT (COUNT(*) * 100 / (COUNT(*) + (SELECT SUM(pending) FROM v1.couchdb_progress))) AS sync_percentage FROM v1.medic;
SELECT (COUNT(*) * 100 / (COUNT(*) + (SELECT SUM(pending) FROM v1.couchdb_progress))) AS sync_percentage FROM v1.couchdb;
```

This query selects the total number of documents that have been synced to the `v1.medic` table and divides it by the total number of documents that have been synced and the number of documents that are pending to be synced. This will give you the percentage of documents that have been synced. Update the table names to match the names of the tables in your database making sure to update the schema name as well. Run this query periodically to monitor the progress of the sync and stop the sync process once you get to the desired percentage. It's okay if it is not exactly 10% as long as it is close enough to give you an idea of the disk space required.
This query selects the total number of documents that have been synced to the `v1.couchdb` table and divides it by the total number of documents that have been synced and the number of documents that are pending to be synced. This will give you the percentage of documents that have been synced. Update the table names to match the names of the tables in your database making sure to update the schema name as well. Run this query periodically to monitor the progress of the sync and stop the sync process once you get to the desired percentage. It's okay if it is not exactly 10% as long as it is close enough to give you an idea of the disk space required.

You can then multiply this figure by 10 to get an estimate of the disk space required for the full dataset and then add some extra space for indexes and other overhead as well as future growth.

Expand Down

0 comments on commit c878ec0

Please sign in to comment.