Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- tweetifai=> d core_tagusage;
- Table "public.core_tagusage"
- Column | Type | Modifiers
- ----------+-----------------------+------------------------------------------------------------
- id | integer | not null default nextval('core_tagusage_id_seq'::regclass)
- tag | character varying(30) | not null
- score | double precision | not null
- tweet_id | character varying(16) | not null
- Indexes:
- "core_tagusage_pkey" PRIMARY KEY, btree (id)
- "core_tagusage_tag_3ed0f993a18dd430_uniq" UNIQUE CONSTRAINT, btree (tag, tweet_id)
- "core_tagusage_cea90699" btree (tweet_id)
- "core_tagusage_score_772bb061400905c6_uniq" btree (score)
- "core_tagusage_tag_443351eb_uniq" btree (tag)
- "core_tagusage_tweet_id_11461293c1e23f80_like" btree (tweet_id varchar_pattern_ops)
- Foreign-key constraints:
- "core_tagusage_tweet_id_11461293c1e23f80_fk_core_imagetweet_id" FOREIGN KEY (tweet_id) REFERENCES core_imagetweet(id) DEFERRABLE INITIALLY DEFERRED
- SELECT *
- FROM (SELECT
- COUNT(ort.tweet_id) AS numtags,
- ort.tweet_id,
- MIN(ort.score) AS minscore
- FROM (SELECT
- tg.tweet_id AS tweet_id,
- tg.tag AS tag,
- tg.score AS score
- FROM core_tagusage AS tg
- WHERE tg.tag = 'dog'
- OR tg.tag = 'grass'
- OR tg.tag = 'frisbee'
- ) AS ort
- GROUP BY ort.tweet_id) AS ct
- WHERE numtags = 3
- ORDER BY minscore DESC
- LIMIT 200;
- Limit (cost=0.56..22720.77 rows=200 width=33) (actual time=24177.117..24177.117 rows=0 loops=1)
- -> GroupAggregate (cost=0.56..1327311.85 rows=11685 width=25) (actual time=24177.115..24177.115 rows=0 loops=1)
- Group Key: tg.tweet_id
- Filter: (count(tg.tweet_id) = 3)
- Rows Removed by Filter: 493764
- -> 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)
- Filter: (((tag)::text = 'dog'::text) OR ((tag)::text = 'grass'::text) OR ((tag)::text = 'frisbee'::text))
- Rows Removed by Filter: 24309855
- Planning time: 0.237 ms
- Execution time: 24177.166 ms
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement