Made statistics queries for metadata more flexible.
More dbms removeal...