Skip to content

Instantly share code, notes, and snippets.

@mitchdowney
Created December 15, 2021 05:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitchdowney/9e593fb451bc273871c0cec06dffb3f5 to your computer and use it in GitHub Desktop.
Save mitchdowney/9e593fb451bc273871c0cec06dffb3f5 to your computer and use it in GitHub Desktop.
mediaRef query by category that hangs forever
EXPLAIN
SELECT "mediaRef"."id" AS "mediaRef_id", "mediaRef"."int_id" AS "mediaRef_int_id", "mediaRef"."endTime" AS "mediaRef_endTime", "mediaRef"."imageUrl" AS "mediaRef_imageUrl", "mediaRef"."isOfficialChapter" AS "mediaRef_isOfficialChapter", "mediaRef"."isOfficialSoundBite" AS "mediaRef_isOfficialSoundBite", "mediaRef"."isPublic" AS "mediaRef_isPublic", "mediaRef"."linkUrl" AS "mediaRef_linkUrl", "mediaRef"."pastHourTotalUniquePageviews" AS "mediaRef_pastHourTotalUniquePageviews", "mediaRef"."pastDayTotalUniquePageviews" AS "mediaRef_pastDayTotalUniquePageviews", "mediaRef"."pastWeekTotalUniquePageviews" AS "mediaRef_pastWeekTotalUniquePageviews", "mediaRef"."pastMonthTotalUniquePageviews" AS "mediaRef_pastMonthTotalUniquePageviews", "mediaRef"."pastYearTotalUniquePageviews" AS "mediaRef_pastYearTotalUniquePageviews", "mediaRef"."pastAllTimeTotalUniquePageviews" AS "mediaRef_pastAllTimeTotalUniquePageviews", "mediaRef"."startTime" AS "mediaRef_startTime", "mediaRef"."title" AS "mediaRef_title", "mediaRef"."createdAt" AS "mediaRef_createdAt", "mediaRef"."updatedAt" AS "mediaRef_updatedAt", "mediaRef"."episodeId" AS "mediaRef_episodeId", "mediaRef"."ownerId" AS "mediaRef_ownerId", "episode"."id" AS "episode_id", "episode"."chaptersType" AS "episode_chaptersType", "episode"."chaptersUrl" AS "episode_chaptersUrl", "episode"."chaptersUrlLastParsed" AS "episode_chaptersUrlLastParsed", "episode"."credentialsRequired" AS "episode_credentialsRequired", "episode"."description" AS "episode_description", "episode"."duration" AS "episode_duration", "episode"."episodeType" AS "episode_episodeType", "episode"."funding" AS "episode_funding", "episode"."guid" AS "episode_guid", "episode"."imageUrl" AS "episode_imageUrl", "episode"."isExplicit" AS "episode_isExplicit", "episode"."isPublic" AS "episode_isPublic", "episode"."linkUrl" AS "episode_linkUrl", "episode"."mediaFilesize" AS "episode_mediaFilesize", "episode"."mediaType" AS "episode_mediaType", "episode"."mediaUrl" AS "episode_mediaUrl", "episode"."pastHourTotalUniquePageviews" AS "episode_pastHourTotalUniquePageviews", "episode"."pastDayTotalUniquePageviews" AS "episode_pastDayTotalUniquePageviews", "episode"."pastWeekTotalUniquePageviews" AS "episode_pastWeekTotalUniquePageviews", "episode"."pastMonthTotalUniquePageviews" AS "episode_pastMonthTotalUniquePageviews", "episode"."pastYearTotalUniquePageviews" AS "episode_pastYearTotalUniquePageviews", "episode"."pastAllTimeTotalUniquePageviews" AS "episode_pastAllTimeTotalUniquePageviews", "episode"."pubDate" AS "episode_pubDate", "episode"."socialInteraction" AS "episode_socialInteraction", "episode"."title" AS "episode_title", "episode"."transcript" AS "episode_transcript", "episode"."value" AS "episode_value", "episode"."podcastId" AS "episode_podcastId", "episode"."createdAt" AS "episode_createdAt", "episode"."updatedAt" AS "episode_updatedAt", "podcast"."id" AS "podcast_id", "podcast"."int_id" AS "podcast_int_id", "podcast"."podcastIndexId" AS "podcast_podcastIndexId", "podcast"."authorityId" AS "podcast_authorityId", "podcast"."alwaysFullyParse" AS "podcast_alwaysFullyParse", "podcast"."credentialsRequired" AS "podcast_credentialsRequired", "podcast"."description" AS "podcast_description", "podcast"."feedLastParseFailed" AS "podcast_feedLastParseFailed", "podcast"."feedLastUpdated" AS "podcast_feedLastUpdated", "podcast"."funding" AS "podcast_funding", "podcast"."guid" AS "podcast_guid", "podcast"."hideDynamicAdsWarning" AS "podcast_hideDynamicAdsWarning", "podcast"."imageUrl" AS "podcast_imageUrl", "podcast"."isExplicit" AS "podcast_isExplicit", "podcast"."isPublic" AS "podcast_isPublic", "podcast"."language" AS "podcast_language", "podcast"."lastEpisodePubDate" AS "podcast_lastEpisodePubDate", "podcast"."lastEpisodeTitle" AS "podcast_lastEpisodeTitle", "podcast"."lastFoundInPodcastIndex" AS "podcast_lastFoundInPodcastIndex", "podcast"."linkUrl" AS "podcast_linkUrl", "podcast"."pastAllTimeTotalUniquePageviews" AS "podcast_pastAllTimeTotalUniquePageviews", "podcast"."pastHourTotalUniquePageviews" AS "podcast_pastHourTotalUniquePageviews", "podcast"."pastDayTotalUniquePageviews" AS "podcast_pastDayTotalUniquePageviews", "podcast"."pastWeekTotalUniquePageviews" AS "podcast_pastWeekTotalUniquePageviews", "podcast"."pastMonthTotalUniquePageviews" AS "podcast_pastMonthTotalUniquePageviews", "podcast"."pastYearTotalUniquePageviews" AS "podcast_pastYearTotalUniquePageviews", "podcast"."shrunkImageUrl" AS "podcast_shrunkImageUrl", "podcast"."shrunkImageLastUpdated" AS "podcast_shrunkImageLastUpdated", "podcast"."sortableTitle" AS "podcast_sortableTitle", "podcast"."title" AS "podcast_title", "podcast"."type" AS "podcast_type", "podcast"."value" AS "podcast_value", "podcast"."createdAt" AS "podcast_createdAt", "podcast"."updatedAt" AS "podcast_updatedAt", "user"."id" AS "user_id", "user"."isPublic" AS "user_isPublic", "user"."name" AS "user_name" FROM "mediaRefs" "mediaRef" INNER JOIN "episodes" "episode" ON "episode"."id"="mediaRef"."episodeId" AND (
"episode"."isPublic" = true
) INNER JOIN "podcasts" "podcast" ON "podcast"."id"="episode"."podcastId" INNER JOIN "podcasts_categories_categories" "podcast_categories" ON "podcast_categories"."podcastsId"="podcast"."id" INNER JOIN "categories" "categories" ON "categories"."id"="podcast_categories"."categoriesId" AND ("categories"."id" IN ('Un7r6iN-l')) INNER JOIN "users" "user" ON "user"."id"="mediaRef"."ownerId" WHERE "mediaRef"."isPublic" = true AND "mediaRef"."isOfficialChapter" IS null ORDER BY "mediaRef"."pastWeekTotalUniquePageviews" DESC LIMIT 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment