Thread: views vs pl/pgsql

views vs pl/pgsql

From
Tomasz Myrta
Date:
Hi
1. I have plpgsql function having only one query returning 1 value. This
query joins some tables. I read, that plpgsql function saves execution
plan for all queries inside one database connection.

2. Instead of this I can create a view returning one row. How does
postgres work with views? When the plan is being created? What happens
to views which don't have explicit joins? What happens if I create index
on tables after creating a view?

Which one is better and when?

Regards,
Tomasz Myrta