Question about postmaster's CPU usage

From: kelphet xiong <kelphet(at)gmail(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Question about postmaster's CPU usage
Date: 2013-03-28 19:07:01
Message-ID: CANnt-4YWdFj5R0J6BkrL1UivU5JSn5-E+3PAyAxY1t0zMV_tRw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi all,

When I use postgres and issue a simple sequential scan for a table
inventory using query "select * from inventory;", I can see from "top" that
postmaster is using 100% CPU, which limits the query execution time. My
question is that, why CPU is the bottleneck here and what is postmaster
doing? Is there any way to improve the performance? Thanks!

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
15401 postgres 20 0 4371m 517m 515m R 99.8 3.2 0:30.14 postmaster

Query: select * from inventory;

explain analyze select * from inventory;
QUERY PLAN

--------------------------------------------------------------------------------------------------------------
------------
Seq Scan on inventory (cost=0.00..180937.00 rows=11745000 width=16)
(actual time=0.005..1030.403 rows=117450
00 loops=1)
Total runtime: 1750.889 ms
(2 rows)

Table "public.inventory"
Column | Type | Modifiers
----------------------+---------+-----------
inv_date_sk | integer | not null
inv_item_sk | integer | not null
inv_warehouse_sk | integer | not null
inv_quantity_on_hand | integer |
Indexes:
"inventory_pkey" PRIMARY KEY, btree (inv_date_sk, inv_item_sk,
inv_warehouse_sk)

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Marty Frasier 2013-03-28 20:45:26 Re: how to help the planner
Previous Message Tom Lane 2013-03-28 16:18:46 Re: how to help the planner