Isn’t there a logging_logindex table to use that should optimize this?
It looks like logging_logindex is useful for queries that are targeting indexes page_time, log_page_id_time, and type_action.
It looks like logging_userindex is useful for queries that are targeting indexes user_time, log_user_type_time, log_user_text_type_time, and log_user_text_time.
Any of the three views should work for the primary key and the type_time and times indexes.
--
Brad Jorsch (Anomie) Senior Software Engineer Wikimedia Foundation