You can query the pg_matviews system catalog view to get ddl of a materialized view in Postgres database. SELECT definition
Continue readingCategory: Postgresql
PostgreSQL – List materialized views
You can query the system catalog view pg_matviews to view all the materialized views. SELECT schemaname, matviewowner, matviewname from pg_matviews;
Continue readingPostgreSQL – Get table size
pg_relation_size() function can be used to obtain the size of a table in bytes in Postgres database. Below is the
Continue readingPostgreSQL – Get database size
Run the below query to get the size of a Postgres database, where ‘your_database_name’ is the name of the database
Continue readingPostgreSQL – Kill user session
Identify the session that you would like to terminate from the below view and copy the pid. SELECT * FROM
Continue readingPostgreSQL – Aggregate Functions
Aggregate functions are functions that are computed over a set of rows to return an output. Average, Max, Min, Sum
Continue readingPostgreSQL – How to limit the number of rows returned by a query
Postgres supports ‘LIMIT’ clause to return only a certain number of rows by a query. Syntax: SELECT * from table1
Continue readingPostgreSQL – LIKE operator
LIKE operator is used to find strings with matching pattern. ‘%’ is used to match any number of characters and
Continue readingPostgreSQL – EXCEPT operator
Postgres EXCEPT operator is used to compare the result sets of 2 queries . It returns rows from first query
Continue readingPostgreSQL – Composite Primary Key
In Relational databases, a primary key is a column(or multiple columns) that is used to uniquely identify rows of a
Continue reading