Chris Browne cbbrowne at lists.slony.info
Fri Jul 27 14:35:38 PDT 2007
Update of /home/cvsd/slony1/slony1-engine/src/backend
In directory main.slony.info:/tmp/cvs-serv21195

Modified Files:
	slony1_funcs.sql 
Log Message:
Per Jacques Caron, shift UPDATE to pg_class.hasrelindex to *after* the
TRUNCATE, as, in 8.2+, TRUNCATE resets this column (which was undoing
our change).

Without this change, indexes would get updated during the COPY, with
a pretty enormous performance "hit."


Index: slony1_funcs.sql
===================================================================
RCS file: /home/cvsd/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.114
retrieving revision 1.115
diff -C2 -d -r1.114 -r1.115
*** slony1_funcs.sql	5 Jul 2007 18:19:04 -0000	1.114
--- slony1_funcs.sql	27 Jul 2007 21:35:36 -0000	1.115
***************
*** 5409,5412 ****
--- 5409,5418 ----
  
  	-- ----
+ 	-- Try using truncate to empty the table and fallback to
+ 	-- delete on error.
+ 	-- ----
+ 	execute ''truncate '' || @NAMESPACE at .slon_quote_input(v_tab_fqname);
+ 	raise notice ''truncate of % succeeded'', v_tab_fqname;
+ 	-- ----
  	-- Setting pg_class.relhasindex to false will cause copy not to
  	-- maintain any indexes. At the end of the copy we will reenable
***************
*** 5416,5425 ****
  	update pg_class set relhasindex = ''f'' where oid = v_tab_oid;
  
- 	-- ----
- 	-- Try using truncate to empty the table and fallback to
- 	-- delete on error.
- 	-- ----
- 	execute ''truncate '' || @NAMESPACE at .slon_quote_input(v_tab_fqname);
- 	raise notice ''truncate of % succeeded'', v_tab_fqname;
  	return 1;
  	exception when others then
--- 5422,5425 ----



More information about the Slony1-commit mailing list