Skip to content

Instantly share code, notes, and snippets.

@drsnyder
Created January 3, 2014 20:24
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/8245874 to your computer and use it in GitHub Desktop.
Save drsnyder/8245874 to your computer and use it in GitHub Desktop.
EXPLAIN ANALYZE on counters WITH primary key on (count_type, count_id)
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.03 rows=1 width=18) (actual time=0.036..0.036 rows=0 loops=1)
Buffers: shared hit=6
-> Seq Scan on public.counters (cost=0.00..5.03 rows=1 width=18) (actual time=0.020..0.021 rows=1 loops=1)
Output: count_type, count_id, (count + 1), ctid
Filter: ((counters.count_type = 0) AND (counters.count_id = 1))
Rows Removed by Filter: 4
Buffers: shared hit=5
Total runtime: 0.059 ms
(8 rows)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment