Oracle database query optimization method