move common code into some helpers

- database related, including model preloading, into helpers/database.rb
- metriks and memory reporting into helpers/reporting.rb
improve the queue log messages
only select the columns we need 

(we don't want the content)