An Azure managed PostgreSQL database service for app development and deployment.
Hi Johann Hackl
In Azure Database for PostgreSQL – Flexible Server, the max_stack_depth parameter is read-only and cannot be changed by users or through a support request. It is fixed at 2 MB (2048 kB) across SKUs and is not tied to compute size.
This limitation exists because the parameter directly affects memory allocation and stability at the service level, so Azure enforces a fixed safe default.
If your workload is hitting this ceiling (e.g., when migrating recursive stored procedures from Oracle), the main options are:
- Refactor recursive logic to be less deep (e.g., iterative approaches where possible).
- Break down complex stored procedures into smaller sub-procedures with controlled stack usage.
- Evaluate alternative approaches such as using Common Table Expressions (CTEs) with iteration where recursion is not essential.
Unfortunately, there’s currently no way to override or increase max_stack_depth in Azure Database for PostgreSQL Flexible Server. If this limitation is a blocker for your migration, I would recommend sharing feedback via Azure Feedback so the product team can consider it in future updates.
Hope this helps. Do let us know if you any further queries.
If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.