PostgreSQL: Performance Test of RETURNS TABLE vs OUT Parameters

One of our PostgreSQL database developers asked one question: What is the performance difference between RETURNS TABLE and OUT parameters?

My simple answer was, no major difference between these two, but RETURNS TABLE is quite faster, easy to write, clear to everyone.

I have prepared two different function one is “plpgsql” and the other is “sql” language.

You can access this demonstration and compare the performance report in your Postgres Environment.

Create a table with sample data:

Create a function to test RETURN TABLE:

Sample Execution:

Performance Report:

Create a function to test the OUT parameter:

Sample Execution:

Performance Report:


Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from dbrnd.com

Leave a Reply

Be the First to Comment!

Notify of
avatar

wpDiscuz