Partial implementation of chart queries in the db
Do all chart queries in SQL
Simplify XLSX doc id query