diff --git a/CN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc b/CN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc index 634dbab0..f63f4691 100644 --- a/CN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc +++ b/CN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc @@ -22,7 +22,7 @@ IvorySQL 作为一款兼容 Oracle 且基于 PostgreSQL 的高级开源数据库 | 9 | xref:master/ecosystem_components/pgrouting.adoc[pgrouting] | 3.8.0 | 提供地理空间数据的路由计算功能,支持多种算法和数据格式 | 地理空间分析、路径规划、物流优化 | 10 | xref:master/ecosystem_components/system_stats.adoc[system_stats] | 3.2 | 提供用于访问系统级统计信息的函数 | 系统监控 | 11 | xref:master/ecosystem_components/wal2json.adoc[wal2json] | 2.6 | 用于 PostgreSQL 逻辑解码的输出插件,为每个事务生成一个JSON对象 | 变更数据捕获(CDC)、实时数据同步、事件驱动微服务、缓存刷新及跨库数据同步等 -| 12 | xref:master/ecosystem_components/pg_stat_monitor.adoc[pg_stat_monitor] | 2.3.1 | 收集性能统计数据,并通过统一视图和直方图形式直观展示查询性能指标。 | 性能监控 +| 12 | xref:master/ecosystem_components/pg_stat_monitor.adoc[pg_stat_monitor] | 2.3.1(PostgreSQL 19 的 Windows 验证使用 2.4.1) | 收集性能统计数据,并通过统一视图和直方图形式直观展示查询性能指标。 | 性能监控 | 13 | xref:master/ecosystem_components/pg_ai_query.adoc[pg_ai_query] | 0.1.1 | AI驱动的自然语言转SQL扩展,支持多种大语言模型 | AI辅助查询、自然语言数据库交互 | 14 | xref:master/ecosystem_components/pg_partman.adoc[pg_partman] | 5.2 | 辅助管理原生分区表,自动创建、维护、清理分区子表 | 海量数据存储管理 | 15 | xref:master/ecosystem_components/pgbouncer.adoc[pgbouncer] | 1.25.1 | PostgreSQL 轻量级连接池,提供连接复用和高效连接管理 | 高并发连接管理、连接复用、减少数据库连接开销 diff --git a/CN/modules/ROOT/pages/master/ecosystem_components/pg_stat_monitor.adoc b/CN/modules/ROOT/pages/master/ecosystem_components/pg_stat_monitor.adoc index b115c687..b19336c8 100644 --- a/CN/modules/ROOT/pages/master/ecosystem_components/pg_stat_monitor.adoc +++ b/CN/modules/ROOT/pages/master/ecosystem_components/pg_stat_monitor.adoc @@ -37,6 +37,31 @@ make USE_PGXS=1 make USE_PGXS=1 install ---- +=== 在 Windows 上从源码构建(PostgreSQL 19) + +IvorySQL 的 PostgreSQL 19 开发版本需要支持 PostgreSQL 19 接口的插件版本。本节验证 `pg_stat_monitor` 2.4.1,测试基线为 https://github.com/IvorySQL/IvorySQL/pull/2321[IvorySQL Windows 移植 PR] 的提交 `7c1742cde16b`。构建工具包括 Visual Studio 2022 的 C/C++ 工具链、Git、Perl、winflexbison3、Meson 和 Ninja。 + +[source,powershell] +---- +git clone https://github.com/IvorySQL/IvorySQL.git IvorySQL +Set-Location IvorySQL +git fetch https://github.com/Muzzammil242/IvorySQL.git 7c1742cde16b699045c94fe053cc8798c1e093cd +git checkout --detach FETCH_HEAD +git clone --depth 1 --branch 2.4.1 https://github.com/percona/pg_stat_monitor.git contrib/pg_stat_monitor +---- + +在 `contrib/pg_stat_monitor/src/hash_query.c` 的 `pgsm_startup()` 中,将 `dsa_create_in_place()` 参数中的条件编译移到宏调用前。声明 `int tranche_id`,保留版本条件,在 PostgreSQL 19 及以上调用 `LWLockNewTrancheId("pg_stat_monitor_dsa")`,较早版本调用 `LWLockNewTrancheId()`。将返回值赋给 `tranche_id`,并用它作为原宏调用的第三个参数。这可避免 MSVC 在宏参数中解析预处理指令时报 C2059。 + +[source,powershell] +---- +Add-Content contrib/meson.build "`nsubdir('pg_stat_monitor')" +meson setup build --vsenv --auto-features=disabled -Duuid=none -Dssl=none -Dbuildtype=release --prefix "$PWD/pg-install" +meson compile -C build pg_stat_monitor +meson install -C build +---- + +安装目录为 `pg-install`。使用测试实例按下文加载插件并执行 `CREATE EXTENSION`。在连接到 PostgreSQL 监听端口的 IPv4 会话中执行 `SELECT 42 AS monitor_smoke;`,再从另一个会话确认统计视图包含该查询且 `client_ip` 为 `127.0.0.1`。2.4.1 对应的 SQL 扩展版本为 `2.4`。可参阅 https://github.com/huier5635-cmd/agentUniverse/actions/runs/44951494790[Windows 构建及启动验证]。 + == 加载模块 在启动时,将 pg_stat_monitor 添加到 shared_preload_libraries 配置参数中,以加载该库。这是因为 pg_stat_monitor 需要额外的共享内存。 diff --git a/EN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc b/EN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc index 463425a7..3fec9954 100644 --- a/EN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc +++ b/EN/modules/ROOT/pages/master/ecosystem_components/ecosystem_overview.adoc @@ -23,7 +23,7 @@ IvorySQL, as an advanced open-source database compatible with Oracle and based o |*9*| xref:master/ecosystem_components/pgrouting.adoc[pgrouting] | 3.8.0 | Provides routing computation for geospatial data, supporting multiple algorithms and data formats | Geospatial analysis, route planning, logistics optimization |*10*| xref:master/ecosystem_components/system_stats.adoc[system_stats] | 3.2 | Provide functions for accessing system-level statistics. | system monitor |*11*| xref:master/ecosystem_components/wal2json.adoc[wal2json] | 2.6 | converts database Write-Ahead Log (WAL) changes into structured JSON format | it is primarily used for change data capture (CDC), real-time data replication, event-driven microservices, cache invalidation, and cross-database synchronization -|*12*| xref:master/ecosystem_components/pg_stat_monitor.adoc[pg_stat_monitor] | 2.3.1 | Collects performance statistics and provides query performance insights in a single view and graphically in histogram. | Performance monitoring +|*12*| xref:master/ecosystem_components/pg_stat_monitor.adoc[pg_stat_monitor] | 2.3.1 (2.4.1 verified for PostgreSQL 19 on Windows) | Collects performance statistics and provides query performance insights in a single view and graphically in histogram. | Performance monitoring |*13*| xref:master/ecosystem_components/pg_ai_query.adoc[pg_ai_query] | 0.1.1 | AI-driven natural language to SQL extension supporting multiple LLMs | AI-assisted querying, natural language database interaction |*14*| xref:master/ecosystem_components/pg_partman.adoc[pg_partman] | 5.2 | Automates the creation, maintenance, and cleanup of native partition subtables. | Large-Scale Data Storage Management |*15*| xref:master/ecosystem_components/pgbouncer.adoc[pgbouncer] | 1.25.1 | Lightweight connection pooler for PostgreSQL | High-concurrency connection management, connection reuse, reduced database connection overhead diff --git a/EN/modules/ROOT/pages/master/ecosystem_components/pg_stat_monitor.adoc b/EN/modules/ROOT/pages/master/ecosystem_components/pg_stat_monitor.adoc index 1b7722c7..73ade9c4 100644 --- a/EN/modules/ROOT/pages/master/ecosystem_components/pg_stat_monitor.adoc +++ b/EN/modules/ROOT/pages/master/ecosystem_components/pg_stat_monitor.adoc @@ -37,6 +37,31 @@ make USE_PGXS=1 make USE_PGXS=1 install ---- +=== Building from source on Windows (PostgreSQL 19) + +The PostgreSQL 19 development version of IvorySQL requires an extension version that supports PostgreSQL 19 interfaces. This procedure tests `pg_stat_monitor` 2.4.1 with commit `7c1742cde16b` from the https://github.com/IvorySQL/IvorySQL/pull/2321[IvorySQL Windows port pull request]. The build uses the Visual Studio 2022 C/C++ toolchain, Git, Perl, winflexbison3, Meson, and Ninja. + +[source,powershell] +---- +git clone https://github.com/IvorySQL/IvorySQL.git IvorySQL +Set-Location IvorySQL +git fetch https://github.com/Muzzammil242/IvorySQL.git 7c1742cde16b699045c94fe053cc8798c1e093cd +git checkout --detach FETCH_HEAD +git clone --depth 1 --branch 2.4.1 https://github.com/percona/pg_stat_monitor.git contrib/pg_stat_monitor +---- + +In `pgsm_startup()` in `contrib/pg_stat_monitor/src/hash_query.c`, move the preprocessor conditional out of the argument list for `dsa_create_in_place()`. Declare `int tranche_id` and preserve the version condition. Assign the return value of `LWLockNewTrancheId("pg_stat_monitor_dsa")` for PostgreSQL 19 and later, or `LWLockNewTrancheId()` for earlier versions. Pass `tranche_id` as the third argument in the original call. This avoids MSVC error C2059 when preprocessing the macro invocation. + +[source,powershell] +---- +Add-Content contrib/meson.build "`nsubdir('pg_stat_monitor')" +meson setup build --vsenv --auto-features=disabled -Duuid=none -Dssl=none -Dbuildtype=release --prefix "$PWD/pg-install" +meson compile -C build pg_stat_monitor +meson install -C build +---- + +Use the test installation under `pg-install` to preload the module and run `CREATE EXTENSION` as described below. Run `SELECT 42 AS monitor_smoke;` in one IPv4 session on the PostgreSQL listener. From a separate session, confirm that the statistics view contains the query with `client_ip` set to `127.0.0.1`. The SQL extension version for release 2.4.1 is `2.4`. See the https://github.com/huier5635-cmd/agentUniverse/actions/runs/44951494790[Windows build and startup test]. + == Load the module Load pg_stat_monitor at the start time by adding it to the shared_preload_libraries configuration parameter. This is because pg_stat_monitor requires additional shared memory.