수행하고 싶지 않은 쿼리가 있습니다. 거의 모든 페이지에서 바닥 글에 4 명의 무작위 교사와 관련 데이터 (이름, 아바타 및 제공하는 코스 수)를 표시합니다.Oracle에서 3 개의 조인을 사용하는이 쿼리를 향상 시키거나 "partition over"를 사용합니까?
Oracle에서이 쿼리의 실행 속도를 어떻게 향상시킬 수 있습니까? 나는 파티션을보고 있었고 다른 파티션과 파티션을 사용하고있었습니다. 나는 mySQL 배경을 가지고 있으며 오라클을 최대한으로 사용하지는 않을 것입니다.
I가 다음과 같은 테이블 구조 :
tutor_profiles:
id
user_id (FK users)
users:
id
username
avatar_id (FK files)
courses:
id
tutor_id (FK tutor_profiles)
description
...
files
id
file_uri
`
그리고이 쿼리가 : 스타터
SELECT * FROM
(SELECT inner_query.*, rownum rnum
FROM (
SELECT tutor_profiles.id AS "tutor_id"
, tutor_profiles.full_name AS "full_name"
, files.file_uri as "file_uri"
, files.id AS file_id
, tutor_profiles.user_id
, count(distinct courses.id) AS "course_count"
FROM tutor_profiles
LEFT JOIN users ON users.id = tutor_profiles.user_id
LEFT JOIN files ON files.id = users.avatar_id
LEFT JOIN courses ON tutor_profiles.id = courses.tutor_id
GROUP BY tutor_profiles.id, tutor_profiles.full_name, tutor_profiles.user_id, files.file_uri, files.id
ORDER BY dbms_random.VALUE
) inner_query
WHERE rownum <= 4)
수행 할 쿼리는 무엇입니까? – Luke101
쿼리는 데이터베이스에서 얼마나 많은 과목을 가지고 있는지, 자신의 프로필 아바타 – Mythriel