I often get to work with different clients and different technologies when I am busy with Comprehensive Database Performance Health Check. Recently, during a consultation, I had to work with PostgreSQL and we needed to find the Definition of a Materialized View.
Well in the earlier version of PostgreSQL, it was not possible to list all the materialized views as well as its definition. However, in the latest version of PostgreSQL, it is now possible to do that with the system view. Here is the script to list the Definition of a Materialized View.
SELECT * FROM pg_matviews;
The script above will give much important information. It will show if the view has any indexes or if the view has any data in it or not.
Here are my few recent videos and I would like to know what is your feedback about them. Do not forget to subscribe SQL in Sixty Seconds series. I hope you appreciate learning about the Last 5 SQL in Sixty Seconds Video.
- Generate Script of SQL Server Objects – SQL in Sixty Seconds #184
- Prevent Unauthorized Index Modifications – SQL in Sixty Seconds #183
- MAX Columns Ever Existed in Table – SQL in Sixty Seconds #182
- Tuning Query Cost 100% – SQL in Sixty Seconds #181
- Queries Using Specific Index – SQL in Sixty Seconds #180
- Read Only Tables – Is it Possible? – SQL in Sixty Seconds #179
- One Scan for 3 Count Sum – SQL in Sixty Seconds #178
- SUM(1) vs COUNT(1) Performance Battle – SQL in Sixty Seconds #177
- COUNT(*) and COUNT(1): Performance Battle – SQL in Sixty Seconds #176
Reference:Â Pinal Dave (http://blog.SQLAuthority.com)