Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Sorrowless
Regular Visitor

PostgreSQL: Exception while reading from stream

Hi Team,

 

I am encountering issues while trying to connect to the PostgreSQL database from Power BI Desktop.

 

Below is the screenshot of the error message-

Sorrowless_0-1731486791356.png

Error message: "PostgreSQL: Exception while reading from stream"

 

This is a high-priority issue for me. Could anyone please advice on how to resolve this?

 

Thank you!

4 REPLIES 4
v-nuoc-msft
Community Support
Community Support

Hi @Sorrowless

 

Thank you very much rajendraongole1 for your prompt reply.

 

Someone has encountered the same problem and the solution mentioned here is to turn on the firewall. This may help you solve the problem:
 
rajendraongole1
Super User
Super User

Hi @Sorrowless - You can use a tool like pgAdmin or a command-line tool to see if you can connect to the database without issues.
If you’re connecting to a remote server, check if there are any network firewalls or VPNs that might be interrupting the connection.Make sure the PostgreSQL server's postgresql.conf and pg_hba.conf files are correctly configured to allow connections from your IP address or network range.
Restart the PostgreSQL service after making any changes to these files.

PostgreSQL: File Browser

 

Power BI might be trying to connect using SSL, which may not be properly configured on your PostgreSQL server. You can adjust SSL settings in the connection string by specifying SSL Mode=Disable, if SSL is not required.
Alternatively, if SSL is required, ensure that it is correctly configured on the server side and that Power BI can connect using SSL.Make sure you are running the latest version of Power BI Desktop. Updates often include bug fixes and improvements for connectivity issues.

 

Hope after performing these steps, try reconnecting in Power BI Desktop it works. 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi @rajendraongole1 ,
Thank you for responding.

 

When I tried giving a value (100) in the 'Command timout' under 'Advance options', Power BI is able to retrieve the data but it took more than an hour. But when I run the same query in DBeaver, it just took a minute to retrieve the data.
I am not really sure about what is causing the issue in this case.

 

Thank you!

Hi @Sorrowless - Try to simplify your Power Query transformations if possible, or ensure they’re pushed directly to the database using query folding. You can check query folding by right-clicking on a step in Power Query and seeing if the "View Native Query" option is available. Ensure that network connectivity is stable. You might also try connecting Power BI to PostgreSQL via a VPN if latency is an issue.

very important:  If your dataset isn't too large for Power BI's memory limits, try switching to Import mode.

Try updating the PostgreSQL driver that Power BI uses. You can download the latest version of the PostgreSQL ODBC driver or switch to an alternative PostgreSQL connector if available.

Review and optimize your query directly within PostgreSQL. If possible, add indexing or optimize joins and filtering. This can sometimes drastically reduce the time required to retrieve data, even from external tools like Power BI.

hope the above suggestions helps. Check for any known issues with the current Power BI Desktop version and consider updating or rolling back to a previous version to see if performance improves.

Previous monthly updates to Power BI Desktop and the Power BI service - Power BI | Microsoft Learn





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.