scoped_all_session not work, error log in postgresql remain
add some thread local variables; optimize detail page query