Created
August 8, 2012 18:07
-
-
Save tamalw/3297135 to your computer and use it in GitHub Desktop.
PostgreSQL performance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXPLAIN ANALYZE | |
SELECT COUNT(*) FROM j_msg | |
Row QUERY PLAN | |
1 Aggregate (cost=1360105.49..1360105.50 rows=1 width=0) (actual time=140042.984..140042.985 rows=1 loops=1) | |
2 -> Seq Scan on j_msg (cost=0.00..1318772.99 rows=16532999 width=0) (actual time=8.377..137051.294 rows=16532999 loops=1) | |
3 Total runtime: 140057.576 ms | |
==== | |
EXPLAIN ANALYZE | |
SELECT | |
COUNT(msgid) msg_cnt, | |
SUM(CASE WHEN parentmsgid IS NULL THEN 1 ELSE 0 END) parent_cnt, | |
SUM(CASE WHEN parentmsgid IS NULL THEN 0 ELSE 1 END) child_cnt | |
FROM j_msg | |
WHERE created_at > (EXTRACT(EPOCH FROM DATE '2012-07-01') * 1000) | |
Row QUERY PLAN | |
1 Aggregate (cost=1442770.49..1442770.50 rows=1 width=16) (actual time=190405.935..190405.935 rows=1 loops=1) | |
2 -> Seq Scan on j_msg (cost=0.00..1401437.98 rows=5511000 width=16) (actual time=634.916..190379.961 rows=45578 loops=1) | |
3 Filter: ((created_at)::double precision > 1341118800000::double precision) | |
4 Total runtime: 190406.077 ms | |
==== | |
table_name indej_name column_name | |
j_msg j_msg_pk msgid | |
j_msg jvmssg_cdate_idx created_at | |
j_msg jvmssg_cidctmd_idx c_type | |
j_msg jvmssg_cidctmd_idx c_id | |
j_msg jvmssg_cidctmd_idx updated_at | |
j_msg jvmssg_mdate_idx updated_at | |
j_msg jvmssg_mdvle_idx m_value | |
j_msg jvmssg_prntid_idx parentmsgid | |
j_msg jvmssg_thrd_idx threadid | |
j_msg jvmssg_usrid_idx userid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment