Added queries

- amount of tables
- bgwriter
- fixed dirty rows query