Fixed queries for low level API
Optimization of CREATE VIEW queries