Code cleanup
Fixed the SQL profiling code
Added profiling support to the PostgreSQL database backend
Truncate queries when they are too long for profiling