/* Show Consumer processing status with age since last updated and changelog entries to process */
SELECT 
	name as "Consumer",
	TIME_FORMAT(SEC_TO_TIME( ROUND((1000*UNIX_TIMESTAMP(NOW()) - last_updated)/1000,0)), '%k:%i:%s' ) as "Age", 
	(max.ct - last_sequence_processed) as "To_Go",
	FROM_UNIXTIME(last_updated/1000) as "Last Updated"
FROM grouper_change_log_consumer LEFT JOIN 
 	(select max(last_sequence_processed) as ct from grouper_change_log_consumer) as max 
 	on name is not NULL
order by To_Go DESC, Age DESC, name DESC
;
