code.forgejo.org database grows too much #105

Open
opened 2025-12-08 12:53:51 +00:00 by earl-warren · 0 comments
  • 19Gb in September
  • 22Gb 26 October
  • 24Gb 6 November

Calculating the size of each table:

(

db=$1
total=0
for table in abuse_report                 notice abuse_report_shadow_copy     notification access                       oauth2_application access_token                 oauth2_authorization_code action                       oauth2_grant action_artifact              org_user action_run                   package action_run_index             package_blob action_run_job               package_blob_upload action_runner                package_cleanup_rule action_runner_token          package_file action_schedule              package_property action_schedule_spec         package_version action_task                  project action_task_output           project_board action_task_step             project_issue action_tasks_version         protected_branch action_variable              protected_tag app_state                    public_key attachment                   pull_auto_merge auth_token                   pull_request auto_merge                   push_mirror badge                        quota_group branch                       quota_group_mapping collaboration                quota_group_rule_mapping comment                      quota_rule commit_status                reaction commit_status_index          release commit_status_summary        renamed_branch dbfs_data                    repo_archive_download_count dbfs_meta                    repo_archiver deploy_key                   repo_indexer_status email_address                repo_redirect email_hash                   repo_topic external_login_user          repo_transfer federated_user               repo_unit federated_user_activity      repository federated_user_follower      review federation_host              review_state follow                       secret following_repo               session forgejo_auth_token           star forgejo_blocked_user         stopwatch forgejo_repo_flag            system_setting forgejo_sem_ver              task forgejo_version              team gpg_key                      team_invite gpg_key_import               team_repo hook_task                    team_unit issue                        team_user issue_assignees              topic issue_content_history        tracked_time issue_dependency             two_factor issue_index                  upload issue_label                  user issue_user                   user_badge issue_watch                  user_blocking label                        user_open_id language_stat                user_redirect lfs_lock                     user_setting lfs_meta_object              version login_source                 watch milestone                    webauthn_credential mirror                       webhook                 ; do
 size=$(sqlite3 $db 'SELECT SUM("pgsize") FROM "dbstat" WHERE name="'$table'"')
 echo "$size $table"
 total=$(expr $total + $size)
done
echo $total total

) | sort -n

2025-11-06

$ ls -l /tmp/gitea.db 
-rw-r--r-- 1 debian debian 25073102848 Nov  6 21:45 /tmp/gitea.db
1114112 pull_request
1269760 commit_status_index
1609728 issue_user
1679360 dbfs_meta
1978368 commit_status_summary
2048000 release
2600960 notification
2981888 package_file
3997696 package_property
4128768 action_artifact
4399104 package_version
4472832 package_blob
11804672 comment
24465408 issue
27398144 issue_content_history
74940416 action_task_step
469889024 action
539418624 action_run_job
583585792 action_run
2692169728 action_task
3034361856 commit_status
14243532800 dbfs_data
21739270144 total

2025-10-26

$ ls -l /srv/forgejo-code-backup/gitea.db
-rw-rw-r-- 1 debian debian 23423639552 Oct 26 05:47 /srv/forgejo-code-backup/gitea.db
1101824 pull_request
1257472 commit_status_index
1519616 dbfs_meta
1576960 issue_user
1949696 commit_status_summary
2011136 release
2539520 notification
2871296 package_file
3899392 package_property
4046848 action_artifact
4280320 package_version
4370432 package_blob
11644928 comment
23642112 issue
26013696 issue_content_history
73084928 action_task_step
464883712 action
518905856 action_run_job
573841408 action_run
2634039296 action_task
3001585664 commit_status
12769447936 dbfs_data
20133773312 total
- 19Gb in September - 22Gb 26 October - 24Gb 6 November --- Calculating the size of each table: ```sh ( db=$1 total=0 for table in abuse_report notice abuse_report_shadow_copy notification access oauth2_application access_token oauth2_authorization_code action oauth2_grant action_artifact org_user action_run package action_run_index package_blob action_run_job package_blob_upload action_runner package_cleanup_rule action_runner_token package_file action_schedule package_property action_schedule_spec package_version action_task project action_task_output project_board action_task_step project_issue action_tasks_version protected_branch action_variable protected_tag app_state public_key attachment pull_auto_merge auth_token pull_request auto_merge push_mirror badge quota_group branch quota_group_mapping collaboration quota_group_rule_mapping comment quota_rule commit_status reaction commit_status_index release commit_status_summary renamed_branch dbfs_data repo_archive_download_count dbfs_meta repo_archiver deploy_key repo_indexer_status email_address repo_redirect email_hash repo_topic external_login_user repo_transfer federated_user repo_unit federated_user_activity repository federated_user_follower review federation_host review_state follow secret following_repo session forgejo_auth_token star forgejo_blocked_user stopwatch forgejo_repo_flag system_setting forgejo_sem_ver task forgejo_version team gpg_key team_invite gpg_key_import team_repo hook_task team_unit issue team_user issue_assignees topic issue_content_history tracked_time issue_dependency two_factor issue_index upload issue_label user issue_user user_badge issue_watch user_blocking label user_open_id language_stat user_redirect lfs_lock user_setting lfs_meta_object version login_source watch milestone webauthn_credential mirror webhook ; do size=$(sqlite3 $db 'SELECT SUM("pgsize") FROM "dbstat" WHERE name="'$table'"') echo "$size $table" total=$(expr $total + $size) done echo $total total ) | sort -n ``` ### 2025-11-06 ```sh $ ls -l /tmp/gitea.db -rw-r--r-- 1 debian debian 25073102848 Nov 6 21:45 /tmp/gitea.db ``` ``` 1114112 pull_request 1269760 commit_status_index 1609728 issue_user 1679360 dbfs_meta 1978368 commit_status_summary 2048000 release 2600960 notification 2981888 package_file 3997696 package_property 4128768 action_artifact 4399104 package_version 4472832 package_blob 11804672 comment 24465408 issue 27398144 issue_content_history 74940416 action_task_step 469889024 action 539418624 action_run_job 583585792 action_run 2692169728 action_task 3034361856 commit_status 14243532800 dbfs_data 21739270144 total ``` ### 2025-10-26 ```sh $ ls -l /srv/forgejo-code-backup/gitea.db -rw-rw-r-- 1 debian debian 23423639552 Oct 26 05:47 /srv/forgejo-code-backup/gitea.db ``` ``` 1101824 pull_request 1257472 commit_status_index 1519616 dbfs_meta 1576960 issue_user 1949696 commit_status_summary 2011136 release 2539520 notification 2871296 package_file 3899392 package_property 4046848 action_artifact 4280320 package_version 4370432 package_blob 11644928 comment 23642112 issue 26013696 issue_content_history 73084928 action_task_step 464883712 action 518905856 action_run_job 573841408 action_run 2634039296 action_task 3001585664 commit_status 12769447936 dbfs_data 20133773312 total ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
infrastructure/k8s-cluster#105
No description provided.