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.
1 2 3 | CREATE INDEX "IX_first_name" ON public.actorfilm (first_name ) |
After creating the index, let’s look at the execution plan of our table.