Re: [GENERAL] hight cpu %sy usage - Mailing list pgsql-general

From Jeff Janes
Subject Re: [GENERAL] hight cpu %sy usage
Date
Msg-id CAMkU=1wLZkcvWnnobEz=kYr4jPB1uorzoUrUgntmbUUyXbG5Lw@mail.gmail.com
Whole thread Raw
In response to [GENERAL] hight cpu %sy usage  ("dbyzaa@163.com" <dbyzaa@163.com>)
List pgsql-general
On Mon, Feb 27, 2017 at 6:13 AM, dbyzaa@163.com <dbyzaa@163.com> wrote:
hello everyone,
 
i have PostgreSQL 9.5.3 server running on redhalt 6.6
when i run one query  with pgbench the cpu is 80% and sy% is 60%

Why is this a problem?  If you run the query as fast as you can, all of the time spent running the query has to go somewhere.  Is there something inherently wrong with much of it going to sy rather than something else?

Can you show us the pgbench command you used?  -c, -j, etc., 


1.the query runing is 2.7ms

Where is that from?  It contradicts the information from the "explain analyze".
 

i drop the btree index  table_name_1_user_id_idx 
create index table_name_1_user_id_idx  on talbe_name_1 using hash(user_id);
vacuum analyze table_name_1

then the cpu is normal !!!!


What happened to the TPS?  It is easy to shift load from sy to us if you do it by making things slower overall by bloating the time spent in user space.  I suspect that that is what happened.

Cheers,

Jeff

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: [GENERAL] ERROR: functions in index expression must be markedIMMUTABLE
Next
From: Francisco Olarte
Date:
Subject: Re: [GENERAL] via psycopg2 or pg2pg? Move rows from one database to other