Skip to content

[BE] 조회성 쿼리 정리

준팍(junpak) edited this page Sep 21, 2023 · 2 revisions
목차

토픽

토픽 전체 조회

Hibernate: 
    select
        * 
    from
        topic t1_0
Hibernate: 
    select
        * 
    from
        member m1_0 
    where
        m1_0.id=?
Hibernate: 
    select 
        * 
    from
        pin p1_0 
    left join
        member c1_0 
            on c1_0.id=p1_0.member_id 
    left join
        location l1_0 
            on l1_0.id=p1_0.location_id 
    where
        p1_0.topic_id=?
Hibernate: 
    select 
        * 
    from
        bookmark b1_0 
    left join
        member m1_0 
            on m1_0.id=b1_0.member_id 
    where
        b1_0.topic_id=?

Latency : 0.107s, Query count : 4, Request URI : /topics

최신 토픽 목록 조회

Hibernate: 
    select 
        * 
    from
        topic t1_0 
    order by
        t1_0.last_pin_updated_at desc
Hibernate: 
    select
        * 
    from
        member m1_0 
    where
        m1_0.id=?
Hibernate: 
    select 
        * 
    from
        pin p1_0 
    left join
        member c1_0 
            on c1_0.id=p1_0.member_id 
    left join
        location l1_0 
            on l1_0.id=p1_0.location_id 
    where
        p1_0.topic_id=?
Hibernate: 
    select 
        * 
    from
        bookmark b1_0 
    left join
        member m1_0 
            on m1_0.id=b1_0.member_id 
    where
        b1_0.topic_id=?

Latency : 0.034s, Query count : 4, Request URI : /topics/newest

인기 급상승 토픽 목록 조회 (즐겨찾기 순서)

Hibernate: 
    select 
        * 
    from
        topic t1_0 
    order by
        t1_0.last_pin_updated_at desc
Hibernate: 
    select 
        * 
    from
        member m1_0 
    where
        m1_0.id=?
Hibernate: 
    select 
        * 
    from
        pin p1_0 
    left join
        member c1_0 
            on c1_0.id=p1_0.member_id 
    left join
        location l1_0 
            on l1_0.id=p1_0.location_id 
    where
        p1_0.topic_id=?
Hibernate: 
    select 
        * 
    from
        bookmark b1_0 
    left join
        member m1_0 
            on m1_0.id=b1_0.member_id 
    where
        b1_0.topic_id=?

Latency : 0.013s, Query count : 4, Request URI : /topics/bests

회원별 토픽 목록 조회

Hibernate: 
    select 
        * 
    from
        topic t1_0 
    order by
        t1_0.last_pin_updated_at desc
Hibernate: 
    select 
        * 
    from
        member m1_0 
    where
        m1_0.id=?
Hibernate: 
    select 
        * 
    from
        pin p1_0 
    left join
        member c1_0 
            on c1_0.id=p1_0.member_id 
    left join
        location l1_0 
            on l1_0.id=p1_0.location_id 
    where
        p1_0.topic_id=?
Hibernate: 
    select 
        * 
    from
        bookmark b1_0 
    left join
        member m1_0 
            on m1_0.id=b1_0.member_id 
    where
        b1_0.topic_id=?

Latency : 0.031s, Query count : 4, Request URI : /topics/members

주변 인기 토픽 목록 조회(핀 개수 기준)

Hibernate: 
    select 
        * 
    from
        member m1_0 
    where
        m1_0.id=?
Hibernate: 
    select 
        * 
    from
        topic c1_0 
    where
        c1_0.member_id=?
Hibernate: 
    select 
        * 
    from
        permission t1_0 
    left join
        topic t2_0 
            on t2_0.id=t1_0.topic_id 
    left join
        member c1_0 
            on c1_0.id=t2_0.member_id 
    where
        t1_0.member_id=?
Hibernate: 
    select 
        * 
    from
        location l1_0 
    where
        (
            6371000*acos((((cos(radians(?))*cos(radians(l1_0.latitude)))*cos((radians(l1_0.longitude)-radians(?))))+(sin(radians(?))*sin(radians(l1_0.latitude)))))
        )<=?
Hibernate: 
    select 
        * 
    from
        pin p1_0 
    left join
        member c1_0 
            on c1_0.id=p1_0.member_id 
    left join
        topic t1_0 
            on t1_0.id=p1_0.topic_id 
    left join
        member c2_0 
            on c2_0.id=t1_0.member_id 
    where
        p1_0.location_id=?
Hibernate: 
    select 
        * 
    from
        pin p1_0 
    left join
        member c1_0 
            on c1_0.id=p1_0.member_id 
    left join
        location l1_0 
            on l1_0.id=p1_0.location_id 
    where
        p1_0.topic_id=?
Hibernate: 
    select 
        * 
    from
        bookmark b1_0 
    left join
        member m1_0 
            on m1_0.id=b1_0.member_id 
    where
        b1_0.topic_id=?

Latency : 0.036s, Query count : 7, Request URI : /locations/bests

토픽 모아보기

Hibernate: 
    select 
        * 
    from
        member m1_0 
    where
        m1_0.id=?
Hibernate: 
    select
    from
        topic t1_0 
    where
        t1_0.id in (?,?)
Hibernate: 
    select 
        * 
    from
        atlas a1_0 
    left join
        topic t1_0 
            on t1_0.id=a1_0.topic_id 
    left join
        member c1_0 
            on c1_0.id=t1_0.member_id 
    where
        a1_0.member_id=?
Hibernate: 
    select 
        * 
    from
        bookmark b1_0 
    left join
        topic t1_0 
            on t1_0.id=b1_0.topic_id 
    left join
        member c1_0 
            on c1_0.id=t1_0.member_id 
    where
        b1_0.member_id=?
Hibernate: 
    select 
        * 
    from
        pin p1_0 
    left join
        member c1_0 
            on c1_0.id=p1_0.member_id 
    left join
        location l1_0 
            on l1_0.id=p1_0.location_id 
    where
        p1_0.topic_id=?
Hibernate: 
    select 
        * 
    from
        bookmark b1_0 
    left join
        member m1_0 
            on m1_0.id=b1_0.member_id 
    where
        b1_0.topic_id=?
Hibernate: 
    select 
        * 
    from
        pin p1_0 
    left join
        member c1_0 
            on c1_0.id=p1_0.member_id 
    left join
        location l1_0 
            on l1_0.id=p1_0.location_id 
    where
        p1_0.topic_id=?
Hibernate: 
    select 
        * 
    from
        bookmark b1_0 
    left join
        member m1_0 
            on m1_0.id=b1_0.member_id 
    where
        b1_0.topic_id=?

Latency : 0.039s, Query count : 8, Request URI : /topics/ids

토픽 상세 조회

Hibernate: 
    select 
        * 
    from
        topic t1_0 
    left join
        member c1_0 
            on c1_0.id=t1_0.member_id 
    where
        t1_0.id=?
Hibernate: 
    select 
        * 
    from
        pin p1_0 
    left join
        member c1_0 
            on c1_0.id=p1_0.member_id 
    left join
        location l1_0 
            on l1_0.id=p1_0.location_id 
    where
        p1_0.topic_id=?
Hibernate: 
    select 
        * 
    from
        bookmark b1_0 
    left join
        member m1_0 
            on m1_0.id=b1_0.member_id 
    where
        b1_0.topic_id=?

Latency : 0.092s, Query count : 3, Request URI : /topics/1

핀 전체 조회

Hibernate: 
    select 
        * 
    from
        member m1_0 
    where
        m1_0.id=?
Hibernate: 
    select 
        * 
    from
        pin p1_0
Hibernate: 
    select 
        * 
    from
        location l1_0 
    where
        l1_0.id=?
Hibernate: 
    select 
        * 
    from
        topic t1_0 
    left join
        member c1_0 
            on c1_0.id=t1_0.member_id 
    where
        t1_0.id=?
Hibernate: 
    select 
        * 
    from
        location l1_0 
    where
        l1_0.id=?

Latency : 0.011s, Query count : 5, Request URI : /pins

회원별 핀 목록 조회

Hibernate: 
    select 
        * 
    from
        member m1_0 
    where
        m1_0.id=?
Hibernate: 
    select 
        * 
    from
        pin p1_0 
    where
        p1_0.member_id=?
Hibernate: 
    select 
        * 
    from
        location l1_0 
    where
        l1_0.id=?
Hibernate: 
    select 
        * 
    from
        topic t1_0 
    left join
        member c1_0 
            on c1_0.id=t1_0.member_id 
    where
        t1_0.id=?

Latency : 0.011s, Query count : 4, Request URI : /pins/members

핀 상세 조회

Hibernate: 
    select 
        * 
    from
        member m1_0 
    where
        m1_0.id=?
Hibernate: 
    select 
        * 
    from
        pin p1_0 
    left join
        member c1_0 
            on c1_0.id=p1_0.member_id 
    join
        location l1_0 
            on l1_0.id=p1_0.location_id 
    join
        topic t1_0 
            on t1_0.id=p1_0.topic_id 
    left join
        member c2_0 
            on c2_0.id=t1_0.member_id 
    where
        p1_0.id=?
Hibernate: 
    select 
        * 
    from
        pin_image p1_0 
    where
        p1_0.pin_id=?

Latency : 0.041s, Query count : 3, Request URI : /pins/1

권한

권한 조회

Hibernate: 
    select
        * 
    from
        topic t1_0 
    left join
        member c1_0 
            on c1_0.id=t1_0.member_id 
    where
        t1_0.id=?
Hibernate: 
    select
        * 
    from
        permission p1_0 
    where
        p1_0.topic_id=?
Hibernate: 
    select
        * 
    from
        member m1_0 
    where
        m1_0.id=?
Hibernate: 
    select
        * 
    from
        member m1_0 
    where
        m1_0.id=?

Latency : 0.028s, Query count : 4, Request URI : /permissions/topics/1

토픽에 권한을 가진 회원 단일 조회

Hibernate: 
    select
        * 
    from
        permission p1_0 
    join
        member m1_0 
            on m1_0.id=p1_0.member_id 
    join
        topic t1_0 
            on t1_0.id=p1_0.topic_id 
    left join
        member c1_0 
            on c1_0.id=t1_0.member_id 
    where
        p1_0.id=?

Latency : 0.017s, Query count : 1, Request URI : /permissions/1