태그별 주제 수

특정 기간(예: 지난 한 달) 동안 각 태그별로 새로 생성된 주제/게시글의 수를 포함한 모든 태그 목록을 가져오고 싶습니다.
쿼리에 대해 도움을 주실 수 있는 분이 계신가요?

파일들을 하나하나 살펴보는 것도 방법이지만, 개인적으로 플러그인 관리 페이지의 메뉴를 사용하는 것이 더 효율적이라고 생각합니다. 테이블을 선택하면 필드 이름과 스키마 정보가 표시되는 여러 테이블을 확인할 수 있을 것입니다.

현재 데스크톱이 아니지만, 모델에는 다음과 같은 내용이 있습니다.

# == Schema Information
#
# Table name: topic_tags
#
#  id         :integer          not null, primary key
#  topic_id   :integer          not null
#  tag_id     :integer          not null
#  created_at :datetime         not null
#  updated_at :datetime         not null
#
# Indexes
#
#  index_topic_tags_on_topic_id_and_tag_id  (topic_id,tag_id) UNIQUE 

여기서 "topic_id"와 "tag_id"가 “테이블 이름_필드 이름” 형식임을 암시합니다.

tag 테이블에는 다음과 같은 내용이 있습니다.

# == Schema Information
#
# Table name: tags
#
#  id             :integer          not null, primary key
#  name           :string           not null
#  topic_count    :integer          default(0), not null
#  created_at     :datetime         not null
#  updated_at     :datetime         not null
#  pm_topic_count :integer          default(0), not null
#  target_tag_id  :integer
#
# Indexes
#
#  index_tags_on_lower_name  (lower((name)::text)) UNIQUE
#  index_tags_on_name        (name) UNIQUE

topic 테이블의 필드는 직접 확인해 보시기 바랍니다.

하지만 아마도 아직 너무 앞서 나가는 이야기일 수 있습니다. 해당 테이블 중 하나에 대해 "Hello Data Explorer"처럼 아주 간단한 쿼리를 실행해 볼 수 있었나요? 어떤 쿼리인가요?

멋지네요, 팁 주셔서 정말 감사합니다.
빌드하는 데 성공했습니다. 완벽하지는 않을 수 있지만, 다른 분들도 유용하게 쓰실 수 있길 바랍니다:

태그별 새 주제 수

-- [params]
-- int :months_ago = 0

WITH query_period as (
    SELECT
        date_trunc('month', CURRENT_DATE) - INTERVAL ':months_ago months' as period_start,
        date_trunc('month', CURRENT_DATE) - INTERVAL ':months_ago months' + INTERVAL '1 month' - INTERVAL '1 second' as period_end
)
SELECT
    tags.name,
    count(1) as topic_count
FROM topics t
RIGHT JOIN topic_tags tt
    ON t.id = tt.topic_id
RIGHT JOIN tags tags
    ON tt.tag_id = tags.id
RIGHT JOIN query_period qp
    ON t.created_at >= qp.period_start
        AND t.created_at <= qp.period_end
WHERE t.user_id > 0
    AND tt.topic_id IS NOT NULL
GROUP BY tags.name
ORDER BY topic_count DESC