archive_index will give a list of years with available data to the template in the context. To discover these years, it will do the following SQL:
SELECT DATE_TRUNC(\'year\', "logviewer_message"."time")
FROM "logviewer_message"
WHERE ("logviewer_message"."channel_id" = 2 AND
"logviewer_message"."time" <= 2006-03-02 12:07:20.758531)
GROUP BY 1 ORDER BY 1 ASC
This is rather icky if you have very much data in your database. For example the IRC logger currently has over 100000 messages stored for the #django channel. It will do an index scan for the timestamp - but that is allways "now" in archive_index, so it won't help much. It will essentially dig through all rows sequentially.
I think either this list of years should be thrown out or should be made optional (add a with_list_of_years parameter to the generic view that people can set if they need this behaviour).