PL/pgSQL procedures for /downloads/total
PL/pgSQL function for daily downloads