Guest User

postgres_groupby

a guest
Oct 11th, 2015
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. query:
  2. SELECT count(status), status from ourtable group by status ORDER BY status;
  3.  
  4. +-------------+-----------------------------+-----------------------------------
  5. | Column | Type | Modifiers
  6. |-------------+-----------------------------+-----------------------------------
  7. | id | integer | not null default nextval('ourtable_id_seq'::regclass) |
  8. | uname | text | not null
  9. | essays | text |
  10. | questions | text |
  11. | details | text |
  12. | status | character(1) | not null default 'q'::bpchar
  13. | qstatus | character(1) | not null default 'q'::bpchar
  14. | media_wc | integer | not null default 0
  15. +-------------+-----------------------------+-----------------------------------
  16. Indexes:
  17. "ourtable_pkey" PRIMARY KEY, btree (id)
  18. "ourtable_uname_key" UNIQUE CONSTRAINT, btree (uname)
  19. "qstatus_idx" btree (qstatus)
  20. "status_idx" btree (status)
  21.  
  22. +---------+----------+
  23. | count | status |
  24. |---------+----------|
  25. | 1480553 | d |
  26. | 458 | p |
  27. | 4331 | q |
  28. | 6347131 | s |
  29. +---------+----------+
  30.  
  31. POSTGRES VERSION 9.3.9
  32. POSTGRES SETTINGS:
  33. shared_buffers = 3GB
  34. maintenance_work_mem = 256MB
  35. work_mem = 256MB
  36.  
  37.  
  38. Ran VACUUM ANALYZE to no avail.
  39. Takes 15 seconds.
  40.  
  41. MySQL with default settings takes a fraction of a second after reboot.
Advertisement
Add Comment
Please, Sign In to add comment