 			LIMIT 1
 			)
 		;
+		
+		
+
+		v_i_evt_replay:=(
+			SELECT 
+				i_id_event[1:p_i_max_events] 
+			FROM 
+				sch_chameleon.t_batch_events 
+			WHERE 
+				i_id_batch=v_i_id_batch
+		);
+
+		v_i_evt_queue:=(
+			SELECT 
+				i_id_event[p_i_max_events+1:array_length(i_id_event,1)] 
+			FROM 
+				sch_chameleon.t_batch_events 
+			WHERE 
+				i_id_batch=v_i_id_batch
+		);
+
 		IF v_i_id_batch IS NULL 
 		THEN
 			RETURN v_b_loop;

);

CREATE UNIQUE INDEX idx_schema_table_source ON sch_chameleon.t_index_def(i_id_source,v_schema,v_table,v_index);

--FUNCTIONS
CREATE OR REPLACE FUNCTION sch_chameleon.fn_refresh_parts() 

					WHEN enm_binlog_event = 'insert'
					THEN
						format(
							'INSERT INTO %I.%I (%s) VALUES (%s);',
							v_schema_name,
							v_table_name,
							array_to_string(t_colunm,','),
