1. Create a materialized view
--视图hnqyhxv_person
CREATE MATERIALIZED VIEW hnqyhxv_person TABLESPACE sys_default as
SELECT
*
FROM E_PRI_PERSON WHERE LEREPSIGN = '1'
2. Create a view index
--创建索引
CREATE INDEX index_hnqyhxv_person_pripid ON hnqyhxv_person(pripid);
3. Check the index
select * from pg_indexes where tablename = 'hnqyhxv_person'
4. Refresh the materialized view (the view will be locked, and the refresh will be faster)
refresh materialized view hnqyhxv_person;
5. Refresh the materialized view (the view will not be locked, and the refresh speed will drop significantly)
refresh materialized view concurrently hnqyhxv_person;