Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi there,
I have a report connected to an externally managed PostgreSQL database that was refreshing fine until the 4th October where it gave the error:
"DataSource.Error: PostgreSQL: 58000: ErrorCode: 08P01 sessionId: f22e9de6-648f-4476-9692-f131cb15c08e queryId: 936e542d-530f-4641-a944-3494320d6f2c Unknown error encountered. Reason: [com.facebook.presto.sql.tree.Union cannot be cast to com.facebook.presto.sql.tree.QuerySpecification]. DataSourceKind = PostgreSQL. DataSourcePath = [datasourcename] Message = 58000: ErrorCode: 08P01 sessionId: f22e9de6-648f-4476-9692-f131cb15c08e queryId: 936e542d-530f-4641-a944-3494320d6f2c Unknown error encountered. Reason: [com.facebook.presto.sql.tree.Union cannot be cast to com.facebook.presto.sql.tree.QuerySpecification]. ErrorCode = -2147467259. . The exception was raised by the IDbCommand interface. Table: Appended Opt-in."
I have since been on a wild goose chase trying to get this sorted. On inspecting the report I began to get another error: "PostgreSQL: 53300: Exceeded session limit of 10" so I assumed the issue was coming from the database side.
After contacting the database administrator, they have come back and told me the issue is with the session limit on the Power BI side, but I have tried adjusting the parallel loading simultaneous evaluations, and clearing the cache and all manner of other suggestions I have found online and nothing has worked.
On further investigation, the issue seems to be coming from a table where I am trying to append data together. If I remove this and load each appended table individually, it appears to be fine, but once I add the appended query I will receive one of the two above errors without fail. I also tried changing the query to a UNION ALL postgreSQL query instead of appending with Power Query but this didn't help either. I'm at a loss for where to go next and am exceedingly frustrated as it was working fine until one day it wasn't.
Any help would be greatly appreciated.
Hi @SachaG it seems you’re dealing with two related challenges: PostgreSQL session limits and query errors in Power BI. Let’s break this down into actionable steps to address both issues:
The error "53300: Exceeded session limit of 10" means PostgreSQL is running out of available sessions. Power BI may be opening too many concurrent connections during the data refresh process. Here’s how you can manage this:
If your queries involve large datasets or complex transformations, they might be overloading the system. To optimize:
Work with your database administrator to review and adjust the session limit configuration on PostgreSQL. Temporarily increasing this limit can help identify if the problem stems from Power BI’s connections or the database itself.
The com.facebook.presto.sql.tree.Union error indicates issues with how Power BI processes query logic when appending tables.
You mentioned trying UNION ALL directly in PostgreSQL. Double-check the query format to ensure compatibility with PostgreSQL. Test it in a tool like pgAdmin.
Example:
If this query works in PostgreSQL, replace Power Query's append operation with a native SQL query using this structure.
If appending tables within Power Query is necessary:
Power BI has built-in tools to analyze refresh issues:
This can help you identify whether the bottleneck lies with the append operation, session limits, or another source.
If these steps don’t resolve your issue, consider using a third-party tool like Windsor.ai. It provides seamless PostgreSQL integration and can simplify how data flows into Power BI.
Hope these suggestions help!
Hi @SachaG
Was rajendraongole1 's reply helpful? If so, could you please mark it as a solution? This will help more users facing the same or similar difficulties. Thanks!
Please feel free to let me know if there are still problems.
Best Regards,
Yulia Xu
Hi @SachaG - Please find the solved thread on the same issue:
https://community.fabric.microsoft.com/t5/Issues/Exceeding-Sessions-Per-User-Limit/idi-p/439136
https://monocroft.com/how-to-fix-power-bi-postgresql-connection-error/
Hope this helps.
Proud to be a Super User! | |
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
85 | |
65 | |
50 | |
45 |
User | Count |
---|---|
217 | |
88 | |
81 | |
65 | |
56 |