Soni M diptatapa at gmail.com
Wed Jun 25 08:00:55 PDT 2014
Hello everyone,

Is it OK to delete event log that has been replicated in sl_log_x.

Here's the function I created :

CREATE OR REPLACE FUNCTION _slony_example.delete_sl_log()
 RETURNS void
 LANGUAGE plpgsql
AS $function$
DECLARE
        v_origin        int8;
        v_seqno         int8;
        v_xmin          bigint;
BEGIN


                for v_origin, v_seqno, v_xmin in
                  select ev_origin, ev_seqno,
"pg_catalog".txid_snapshot_xmin(ev_snapshot) from "_slony_example".sl_event
                  where (ev_origin, ev_seqno) in (select ev_origin,
min(ev_seqno) from "_slony_example".sl_event where ev_type = 'SYNC' group
by ev_origin)
                loop

delete from _slony_example.sl_log_1 where log_origin = v_origin and
log_txid < v_xmin;
delete from _slony_example.sl_log_2 where log_origin = v_origin and
log_txid < v_xmin;
                end loop;

END;
$function$;

The Slony failed to switch sl_log for several hours, and event log keep
accumulated in a table.

Will this action help to reduce slony lag that falls far behind ?

Thanks all.

-- 
Regards,

Soni Maula Harriz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.slony.info/pipermail/slony1-general/attachments/20140625/9e8d469a/attachment.html 


More information about the Slony1-general mailing list