 );
 
 
-CREATE OR REPLACE FUNCTION entity_tag.process_staged_links()
+CREATE OR REPLACE FUNCTION entity_tag.process_staged_links(process_limit integer)
 	RETURNS entity_tag.process_staged_links_result
 AS $$
 DECLARE
     result entity_tag.process_staged_links_result;
 BEGIN
 	result.tags_added = entity_tag.add_new_tags();
-	result.links_added = entity_tag.add_new_links();
+	result.links_added = entity_tag.add_new_links($1);
 	result.links_removed = entity_tag.remove_obsolete_links();
 
 	TRUNCATE entity_tag.entitytaglink_staging;

GRANT SELECT ON TABLE entity_tag._new_links_in_staging TO minerva;


CREATE OR REPLACE FUNCTION entity_tag.add_new_links()
	RETURNS bigint
AS $$
	WITH t AS (
		INSERT INTO directory.entitytaglink(entity_id, tag_id)
		SELECT entity_id, tag_id
		FROM entity_tag._new_links_in_staging
		RETURNING *
	)
	SELECT count(*) FROM t;

);


CREATE OR REPLACE FUNCTION entity_tag.update(type_name name, update_limit integer DEFAULT 50000)
	RETURNS entity_tag.update_result
AS $$
DECLARE
