Add sql queries to work with docs-terms matrices
General matrix product with sql