build(repo): structure the repo into postgresql subdirectory with separate template and internal tests

This commit is contained in:
Maksym Buz
2026-03-30 21:18:01 +00:00
parent 7339bf5db0
commit 3b4f0c9c75
33 changed files with 19 additions and 8 deletions

8
postgresql/README.md Normal file
View File

@@ -0,0 +1,8 @@
# PostgreSQL Partitioning for Zabbix
This directory contains solutions for partitioning a Zabbix database running on PostgreSQL. Partitioning is essential for large Zabbix environments as it eliminates the need for the built-in Zabbix Housekeeper to aggressively delete old data row-by-row, replacing it with instant DDL operations that drop entire daily or monthly chunks.
## Implementations
- **[procedures](procedures/)**: The recommended Declarative (SQL-based) implementation. It uses native PostgreSQL procedures and features like `pg_cron` for entirely self-contained maintenance.
- **[script](script/)**: External script-based management solution. (Coming soon)

View File

@@ -0,0 +1,3 @@
# Script-based Partitioning
(Coming soon)

View File

@@ -67,17 +67,17 @@ if [[ -f "$SQL_DIR/schema.sql" ]]; then
cp "$SQL_DIR/schema.sql" ./init_scripts/01_00_schema.sql cp "$SQL_DIR/schema.sql" ./init_scripts/01_00_schema.sql
# 1.1 Partitioning Infrastructure # 1.1 Partitioning Infrastructure
if [[ -f "../procedures/00_schema_create.sql" ]]; then if [[ -f "../../procedures/00_schema_create.sql" ]]; then
cp "../procedures/00_schema_create.sql" ./init_scripts/01_10_schema_create.sql cp "../../procedures/00_schema_create.sql" ./init_scripts/01_10_schema_create.sql
fi fi
if [[ -f "../procedures/01_maintenance.sql" ]]; then if [[ -f "../../procedures/01_maintenance.sql" ]]; then
cp "../procedures/01_maintenance.sql" ./init_scripts/01_30_maintenance.sql cp "../../procedures/01_maintenance.sql" ./init_scripts/01_30_maintenance.sql
fi fi
if [[ -f "../procedures/02_enable_partitioning.sql" ]]; then if [[ -f "../../procedures/02_enable_partitioning.sql" ]]; then
cp "../procedures/02_enable_partitioning.sql" ./init_scripts/01_40_enable.sql cp "../../procedures/02_enable_partitioning.sql" ./init_scripts/01_40_enable.sql
fi fi
if [[ -f "../procedures/03_monitoring_view.sql" ]]; then if [[ -f "../../procedures/03_monitoring_view.sql" ]]; then
cp "../procedures/03_monitoring_view.sql" ./init_scripts/01_50_monitoring.sql cp "../../procedures/03_monitoring_view.sql" ./init_scripts/01_50_monitoring.sql
fi fi
else else
echo -e "${RED}Error: schema.sql not found in $SQL_DIR${NC}" echo -e "${RED}Error: schema.sql not found in $SQL_DIR${NC}"