Christopher B. Browne's Home Page
cbbrowne@acm.org

8.48. disable_indexes_on_table(i_oid oid)

Function Properties

PLPGSQLinteger
disable indexes on the specified table. Used during subscription process to suppress indexes, which allows COPY to go much faster. This may be set as a SECURITY DEFINER in order to eliminate the need for superuser access by Slony-I.
    begin
    	-- Setting pg_class.relhasindex to false will cause copy not to
    	-- maintain any indexes. At the end of the copy we will reenable
    	-- them and reindex the table. This bulk creating of indexes is
    	-- faster.
    
    	update pg_catalog.pg_class set relhasindex ='f' where oid = i_oid;
    	return 1;
    end 

Google

If this was useful, let others know by an Affero rating

Contact me at cbbrowne@acm.org