Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iMQlG-0001ro-6b for pgsql-general@arkaria.postgresql.org; Mon, 21 Oct 2019 06:01:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iMQlE-0006pd-Tv for pgsql-general@arkaria.postgresql.org; Mon, 21 Oct 2019 06:01:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iMQlE-0006pW-CO for pgsql-general@lists.postgresql.org; Mon, 21 Oct 2019 06:01:44 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iMQlB-00079R-FJ for pgsql-general@lists.postgresql.org; Mon, 21 Oct 2019 06:01:43 +0000 Received: by mail-wr1-x442.google.com with SMTP id n15so1524801wrw.13 for ; Sun, 20 Oct 2019 23:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=nt9c6rTGZzsGlLm623UsJcR6YXdiTZTxjLUL9m4oLDg=; b=OSqJxzLpsIkZM7PZ8mj7Fst/yqlNMsSOPUEN8O6FvXE5PWd682ZPMC/yh2WOUt1w/y Pb+1VAAWjHeRjvKP+jy2COLbdvQdHRPp45sY5Fp9ZLKCjnF8oyi8rBs8sUpOjOuqJHlf ozFtI25GKswaQTJvPUBGFigyGTpVYjF5kKyqLcLFPY9Wnl1jt6rtKEldx/r0G1cTEKH7 iBjB9jEsHUSMQDC5GjRn9pYiohTk1JYVE+48EbWolRWkCeFOZnqVlG7oM9b2d/UVUNeX aaBSHarVHEGRHD83Z/SSqEIEuR+bwCfMeAOfuozZzfq93BewOB5tB/CM8SL03M/ZiIWn bsMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=nt9c6rTGZzsGlLm623UsJcR6YXdiTZTxjLUL9m4oLDg=; b=Flg1gDlsO7O3iE+UvhDp0T50bWCyUjp9FL5MRh4cTZUm2Mrhg2OU3K2BQ3TKUnuEfP xw3SbhAnNBISPoVE2aUTHIw15gE09WYxy1hW4FuDBiQKX5buU3zGP+mThCQjWOKpfyZj TpwjoubqCLqk/ZxXykAy8vfNzrJQZ3Uj6LMgq02HhXJbUwDaka/2u8smFm7tn1oxBd0R n7yIut55Jvnd9kz04cYQi2P/KEcPDGa5DGiwWI54yxJpsCiZZq27mNcsGvCmsBiwGYkc F9ez8B8UXiTUKBGiPIgUe8g4qfB9aZANqt/rr6zMhRVWgWIaZxu8iB/Qlcia6xPMzl7a xxPA== X-Gm-Message-State: APjAAAWZvYDBY+5BmBShxsrnvndBSwpxE+UQ3ZYAs0Nu4NxBGW11Y1MJ YuPbpUnj5DJfqssu22xgAUdUJA== X-Google-Smtp-Source: APXvYqzuvBoAZX9sI7//MBxh4EHSvocycdXYSBIx7iWZsppDqnxH7ZgmwyBtkRgnXBvt0y/WNcDKeA== X-Received: by 2002:a5d:6246:: with SMTP id m6mr12929796wrv.262.1571637699860; Sun, 20 Oct 2019 23:01:39 -0700 (PDT) Received: from localhost (cst-prg-22-237.cust.vodafone.cz. [46.135.22.237]) by smtp.gmail.com with ESMTPSA id z6sm13373453wro.16.2019.10.20.23.01.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Oct 2019 23:01:39 -0700 (PDT) Date: Mon, 21 Oct 2019 08:01:37 +0200 From: Tomas Vondra To: Pawan Sharma Cc: pgsql-general@lists.postgresql.org Subject: Re: CPU SPIKE Message-ID: <20191021060137.6uetb242vw44hudo@development> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Oct 21, 2019 at 10:45:33AM +0530, Pawan Sharma wrote: >Hi All, > >Having real high CPU issue (95-98%), with SELECT statements and select >queries contains multiple AND operator, is it will cause any CPU Spike..??? > >apps team is using sub-partition, PG11, CPU:24, Mem: 16GB > Any query execution is using CPU, so yes - it can cause a spike in CPU usage. The question is whether the query plan is efficient, or whether it's using the CPU unenecessarily. You need to show us EXPLAIN ANALYZE and perhaps explain why you think it shouldn't use this much CPU. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services