Thursday , December 26 2024

Create Index On PostgreSQL Materialized View

In today’s article, I will be explaining to you how to Create an Index on PostgreSQL Materalized View.

Another nice feature of the Materialized view is that we can assign an index to the created Materialized view.

I want to add an index to the first_name column to speed up the query below.

We see that the query above performs seq_scan. Let’s speed up our query a little more by adding an index.

After creating the index, let’s look at the execution plan of our table.

The index we added has started to speed up our query by performing an index scan.

Loading

About Faruk Erdem

Leave a Reply

Your email address will not be published. Required fields are marked *