Skip to content

Instantly share code, notes, and snippets.

@drsnyder
Created January 3, 2014 20:09
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 drsnyder/8245583 to your computer and use it in GitHub Desktop.
Save drsnyder/8245583 to your computer and use it in GitHub Desktop.
EXPLAIN ANALYZE on counters with no primary or unique key.
test=# explain (analyze, buffers, verbose) update counters set count = count + 1 where count_type = 0 and count_id = 1;
QUERY PLAN ------------------------------------------------------------------------------------------------------------------
Update on public.counters (cost=0.00..5.74 rows=15 width=18) (actual time=0.110..0.110 rows=0 loops=1)
Buffers: shared hit=20
-> Seq Scan on public.counters (cost=0.00..5.74 rows=15 width=18) (actual time=0.014..0.054 rows=15 loops=1)
Output: count_type, count_id, (count + 1), ctid
Filter: ((counters.count_type = 0) AND (counters.count_id = 1))
Rows Removed by Filter: 32
Buffers: shared hit=5
Total runtime: 0.137 ms
(8 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment