Advertisement
Guest User

Untitled

a guest
Jul 26th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. tweetifai=> d core_tagusage;
  2. Table "public.core_tagusage"
  3. Column | Type | Modifiers
  4. ----------+-----------------------+------------------------------------------------------------
  5. id | integer | not null default nextval('core_tagusage_id_seq'::regclass)
  6. tag | character varying(30) | not null
  7. score | double precision | not null
  8. tweet_id | character varying(16) | not null
  9. Indexes:
  10. "core_tagusage_pkey" PRIMARY KEY, btree (id)
  11. "core_tagusage_tag_3ed0f993a18dd430_uniq" UNIQUE CONSTRAINT, btree (tag, tweet_id)
  12. "core_tagusage_cea90699" btree (tweet_id)
  13. "core_tagusage_score_772bb061400905c6_uniq" btree (score)
  14. "core_tagusage_tag_443351eb_uniq" btree (tag)
  15. "core_tagusage_tweet_id_11461293c1e23f80_like" btree (tweet_id varchar_pattern_ops)
  16. Foreign-key constraints:
  17. "core_tagusage_tweet_id_11461293c1e23f80_fk_core_imagetweet_id" FOREIGN KEY (tweet_id) REFERENCES core_imagetweet(id) DEFERRABLE INITIALLY DEFERRED
  18.  
  19. SELECT *
  20. FROM (SELECT
  21. COUNT(ort.tweet_id) AS numtags,
  22. ort.tweet_id,
  23. MIN(ort.score) AS minscore
  24. FROM (SELECT
  25. tg.tweet_id AS tweet_id,
  26. tg.tag AS tag,
  27. tg.score AS score
  28. FROM core_tagusage AS tg
  29. WHERE tg.tag = 'dog'
  30. OR tg.tag = 'grass'
  31. OR tg.tag = 'frisbee'
  32. ) AS ort
  33. GROUP BY ort.tweet_id) AS ct
  34. WHERE numtags = 3
  35. ORDER BY minscore DESC
  36. LIMIT 200;
  37.  
  38. Limit (cost=0.56..22720.77 rows=200 width=33) (actual time=24177.117..24177.117 rows=0 loops=1)
  39. -> GroupAggregate (cost=0.56..1327311.85 rows=11685 width=25) (actual time=24177.115..24177.115 rows=0 loops=1)
  40. Group Key: tg.tweet_id
  41. Filter: (count(tg.tweet_id) = 3)
  42. Rows Removed by Filter: 493764
  43. -> Index Scan using core_tagusage_cea90699 on core_tagusage tg (cost=0.56..1321691.90 rows=547389 width=25) (actual time=0.206..23322.853 rows=501654 loops=1)
  44. Filter: (((tag)::text = 'dog'::text) OR ((tag)::text = 'grass'::text) OR ((tag)::text = 'frisbee'::text))
  45. Rows Removed by Filter: 24309855
  46. Planning time: 0.237 ms
  47. Execution time: 24177.166 ms
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement