Optimized queries for tv/show template, fixes #31