The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi, I have data that is in a dataflow in powerBI that is brought in through PostgreSQL,
1 of the tables is currently not refreshing and giving the below error, please advise on what could be the common causes and what to look out for
We encountered the following error while fetching additional rows: "PostgreSQL: 54001: stack depth limit exceeded"
Hi @TaariqMegaC
PostgreSQL has a configuration parameter called max_stack_depth, which specifies the maximum safe depth of the server's execution stack. The default value is set to 2MB. If your queries are complex, they may exceed this limit, especially if they involve deep recursion or nested subqueries.
If your dataflow includes complex queries, particularly those involving nested updates or deep recursion, this could lead to the stack depth error. A contrived query can cause unreasonable amounts of time spent trying to flatten subqueries, which may not only lead to performance issues but also trigger the stack depth limit.
As a potential workaround, you can increase the max_stack_depth parameter within a session if you have superuser access. This adjustment may temporarily resolve the issue but should be done cautiously, ensuring that it does not adversely affect the overall performance of the database.
SET max_stack_depth = '4MB'; -- Example value, adjust as needed
Consider whether any recent changes to the database schema or query design have introduced complexity. This could include new joins, additional calculated fields, or modifications in how data is being retrieved.
Performance-related issues, such as high load on the database server or resource throttling, can also contribute to this error. Monitoring the performance metrics can provide insights into whether resource limits are being exceeded.
If the error began occurring after a specific date, such as October 4th in your case, it may be worthwhile to investigate any changes made around that time, including updates to PostgreSQL itself or any changes in the data sources being queried
Proud to be a Super User! | |
Thank you please advise on the steps to increase it
Hi @TaariqMegaC
Thanks for reaching out with your query!
To better assist you,for more in-depth troubleshooting and to get insights from other experts, I recommend posting your issue in the PostgreSQL: Contact
Regards,
Atheeq.
Thank you, how do i increase the max stack depth
Hi @TaariqMegaC
The "stack depth limit exceeded" issue in PostgreSQL typically happens when a query involves too much recursion or overly complex operations that exceed PostgreSQL's memory stack limits(max_stack_depth parameter (default is 2MB)).
A few things we can check:
Recursive Logic – Does the table involve any recursive CTEs, circular references, or self-referencing joins?
Query Folding – Some Power Query transformations might generate inefficient SQL. Could you share the query steps applied to this table?
Data Model – Are there any loops in relationships between this table and others?
PostgreSQL Views/Functions – If the table relies on a view or function, we should verify its logic.
A quick fix might be simplifying the query or breaking it into smaller steps. If you can share:
The table structure
Any custom SQL or M-code used
The transformations applied in Power Query
User | Count |
---|---|
78 | |
73 | |
38 | |
30 | |
28 |
User | Count |
---|---|
107 | |
100 | |
55 | |
49 | |
45 |