Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZGY9-00007G-3J for pgsql-performance@arkaria.postgresql.org; Tue, 29 Mar 2022 18:26:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nZGY8-00068W-1c for pgsql-performance@arkaria.postgresql.org; Tue, 29 Mar 2022 18:26:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZGWZ-0001fT-RG for pgsql-performance@lists.postgresql.org; Tue, 29 Mar 2022 18:24:59 +0000 Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nZGWW-0007jQ-SD for pgsql-performance@lists.postgresql.org; Tue, 29 Mar 2022 18:24:58 +0000 Received: by mail-il1-x12d.google.com with SMTP id u13so4006742ilv.6 for ; Tue, 29 Mar 2022 11:24:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9KirijIYcohHymWEHYfrX3SCjhBAuQa3/H0+G8UUlc4=; b=0YqfE1b8Ui0cCg8t09AfIuMTOcwclspnz4ylxRfNsO7ogVZJCkIZyMpURFt48kTYhz ETldzQzNVJeCfasPDWwSVyn7dPVE37xPX8T+P6NTWxyVCefRHfRDB+ATB+VlauQ4vlj3 EWVAzu2pswqyjSjuuu20ZAaaSKaT9WSY1JGJ9N8Pt8PwMMPMk79/A369rbpL1p+4EXhL 0C2GNI7xHSx+nl7AbRRKHtGZycL/xB2oh/BO5q8dVUvC6YFcMD9rnMoDD5GBx36wDnUj 1r1jigSdxYQAhmsuo8LL6hRXqwWdZZ5LkcKQm/BeXXRXFltwNQlDfRshyIDrRt4OPHij Chbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9KirijIYcohHymWEHYfrX3SCjhBAuQa3/H0+G8UUlc4=; b=ihEZnO4gDuoULoWzXzpVpwmSH7UFQDO25gmX8umS1KLAqzJQunAgZwir0KfuBdUFfa 6YYBBnI4mv0jZQk50ou+5/Y0OhjsYSd/Bt8RWjaAlFNUG8uYXSSlsdQMIlcNorXba58z vNgb4BIwhiJWuQmZPJJ4YL4MwZe82UZZlmOwHdKK0gqUEM11gw2zqxmF4gSP9ocp9V8v Ouh4mDyJfoEiFk/L85UAUFfAmLoGF/Bm/1ph/v+ROPg86+YxYKuiXslNSfHZsK+JyOTh R+uzPU4juFuZUIfiQ+9a5QkTPpL5XZyxTkX5tmi4IKJXWvJd8H68GpuAzqXWxU16ebOZ LY5Q== X-Gm-Message-State: AOAM531vAV6Eaze9gGp85QXfAWsLa/diqYSYSV+hV/kpR7zG2Fnu/YsK FHIuRrnFwyZEeLaZBXRLK26Xow== X-Google-Smtp-Source: ABdhPJzeyW2qylHHrx9koM23562m7HiBoXPMSKkeqxY2e5bpwXykUxz9qQFkVfzSKibzP2PU3XKc5w== X-Received: by 2002:a05:6e02:164e:b0:2c9:9849:dd5b with SMTP id v14-20020a056e02164e00b002c99849dd5bmr8459886ilu.81.1648578295945; Tue, 29 Mar 2022 11:24:55 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id b12-20020a6be70c000000b00648f61d9652sm9727423ioh.52.2022.03.29.11.24.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Mar 2022 11:24:54 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id D58C08009D6; Tue, 29 Mar 2022 13:24:53 -0500 (CDT) Date: Tue, 29 Mar 2022 13:24:53 -0500 From: Justin Pryzby To: Rambabu g Cc: pgsql-performance@lists.postgresql.org Subject: Re: HIGH IO and Less CPU utilization Message-ID: <20220329182453.GA28503@telsasoft.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, Thanks for providing all this info. On Tue, Mar 29, 2022 at 11:34:18PM +0530, Rambabu g wrote: > Hi All, > > We have an issue with high load and IO Wait's but less cpu on postgres > Database, The emp Table size is around 500GB, and the connections are very > less. What indexes are defined on this table ? How large are they ? > Red Hat Enterprise Linux Server release 7.9 (Maipo) > PostgreSQL 11.15 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit > > shared_buffers=12GB > work_mem=128MB > 14428 | 04:45:59.712892 | active | INSERT INTO target (empno, name) > SELECT empno, '' AS name FROM (select distinct empno from emp where sname='test' > and tp='EMP NAME 1' LIMIT 10) AS query ; Is the only only problem query, or just one example or ?? Are your issues with loading data, querying data or both ? > -bash-4.2$ iostat -x It shows that you only have a few filesystems in use. It's common to have WAL and temp_tablespaces on a separate FS. That probably wouldn't help your performance at all, but it would help to tell what's doing I/O. Is there anything else running on the VM besides postgres ? You can also check: SELECT COUNT(1), wait_event FROM pg_stat_activity GROUP BY 2 ORDER BY 1 DESC; And the pg_buffercache extension: SELECT COUNT(nullif(isdirty,'f')) dirty, COUNT(1) all, COALESCE(c.relname, b.relfilenode::text) FROM pg_buffercache b LEFT JOIN pg_class c ON b.relfilenode=pg_relation_filenode(c.oid) GROUP BY 3 ORDER BY 1 DESC,2 DESC LIMIT 9; > Hypervisor vendor: KVM Are KSM or THP enabled on the hypervisor ? tail /sys/kernel/mm/ksm/run /sys/kernel/mm/transparent_hugepage/khugepaged/defrag /sys/kernel/mm/transparent_hugepage/enabled /sys/kernel/mm/transparent_hugepage/defrag -- Justin