Problem in postgresql query timeout