Docs: PostgresSQL Doc Updation (#20296)

Co-authored-by: Rounak Dhillon <rounakdhillon@Rounaks-MacBook-Air.local>
This commit is contained in:
Rounak Dhillon 2025-03-17 16:44:27 +05:30 committed by GitHub
parent d9cd030c55
commit bec15d5c82
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 8 deletions

View File

@ -53,26 +53,33 @@ Then, when extracting usage and lineage data, the query log duration will have n
```sql
GRANT pg_read_all_stats TO your_user;
```
## Stored Procedures
When executing stored procedures in PostgreSQL, lineage extraction relies on capturing the SQL queries executed within the procedure. However, by default, PostgreSQL does not track the internal queries of a stored procedure in `pg_stat_statements`.
### Enabling Query Tracking for Lineage
To ensure OpenMetadata captures lineage from stored procedures, follow these steps:
1. **Enable Logging for All Statements**
   Modify the `postgresql.conf` file and set:
   ```ini
   log_statement = 'all'
   ```
   This will log all executed SQL statements, including those inside stored procedures.
 This will log all executed SQL statements, including those inside stored procedures.
2. **Configure `pg_stat_statements` to Track Nested Queries**
   By default, `pg_stat_statements` may only capture top-level procedure calls and not the internal queries. To change this behavior, update:
   
By default, `pg_stat_statements` may only capture top-level procedure calls and not the internal queries. To change this behavior, update:
   ```ini
   pg_stat_statements.track = 'all'
   ```
   This ensures that statements executed within procedures are recorded.
This ensures that statements executed within procedures are recorded.
## Metadata Ingestion

View File

@ -54,26 +54,32 @@ Then, when extracting usage and lineage data, the query log duration will have n
GRANT pg_read_all_stats TO your_user;
```
## Capturing Lineage for Stored Procedures in PostgreSQL
## Stored Procedures
When executing stored procedures in PostgreSQL, lineage extraction relies on capturing the SQL queries executed within the procedure. However, by default, PostgreSQL does not track the internal queries of a stored procedure in `pg_stat_statements`.
### Enabling Query Tracking for Lineage
To ensure OpenMetadata captures lineage from stored procedures, follow these steps:
1. **Enable Logging for All Statements**
   Modify the `postgresql.conf` file and set:
Modify the `postgresql.conf` file and set:
   ```ini
   log_statement = 'all'
   ```
   This will log all executed SQL statements, including those inside stored procedures.
 This will log all executed SQL statements, including those inside stored procedures.
2. **Configure `pg_stat_statements` to Track Nested Queries**
   By default, `pg_stat_statements` may only capture top-level procedure calls and not the internal queries. To change this behavior, update:
By default, `pg_stat_statements` may only capture top-level procedure calls and not the internal queries. To change this behavior, update:
   ```ini
   pg_stat_statements.track = 'all'
   ```
   This ensures that statements executed within procedures are recorded.
This ensures that statements executed within procedures are recorded.
## Metadata Ingestion