Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g3BCj-0004a0-1a for pgsql-performance@arkaria.postgresql.org; Fri, 21 Sep 2018 02:30:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g3BCh-0000xj-Is for pgsql-performance@arkaria.postgresql.org; Fri, 21 Sep 2018 02:29:59 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g3BCh-0000wk-3g for pgsql-performance@lists.postgresql.org; Fri, 21 Sep 2018 02:29:59 +0000 Received: from mail-it1-x142.google.com ([2607:f8b0:4864:20::142]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1g3BCd-0001gb-N7 for pgsql-performance@lists.postgresql.org; Fri, 21 Sep 2018 02:29:57 +0000 Received: by mail-it1-x142.google.com with SMTP id h1-v6so363309itj.4 for ; Thu, 20 Sep 2018 19:29:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-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=XgF3NSlfSpZyOFLeDyp006DI2NhgJewLpA9QVyZDUJY=; b=piADebGmzdPf2D8rY+dAjLCOhGdZESyVNlbgMWPDUbzO+OWfmfvLaRW9ef+dR4rcVX hsCXo8qjf7nHl/TUZj16NfRnVo+VsjGSmlqVYdWrKT9C+34Eecf41XJ6luJOPD86GjfP 1PdZqD6+UD3Eo0ZL0Fe+WegxsXgk7zwJC8HXggUVg500n7JI/MtF9bukikdlHWWbY3Lg meAofpuGHrAufVhhb60UAW+zTfTj1xHAPdy5YzTh2Xxzn9BR679g3sHR7KYpWXMaTdyG K2KNcts+yrqRWWv283hH0G+w8s4B7n9Krvtn3EswctOAwXi5dcE7dP0pjP0MDz9RPwbc TCGg== 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=XgF3NSlfSpZyOFLeDyp006DI2NhgJewLpA9QVyZDUJY=; b=RUYUDKhgjzyOjIFl0EKUfa/RPwLenL32H64qczuyiR/auXxloLCuIQEXEWEgCkpnLF HoO38RwlP4Wr4FhV/IgJZ7nhC3593zFQePmKeVFL91aQJtstDqi0Hbf4R6MgiYkYWv99 b6qrMUmJiS0KSrWCzMV1AupMKFEh6JZq8xP3QCj3bkY0U/cpkvDhK7PFv62vvlsdHPxm t87n2jz7j8RCfhiRuxQ1RLzZdGTHlYx3YRHcdG/wYDuIoIEWCx1x5SwW1b0LIcfaL00A P6GD2X9Vv4NG0ZSX9x1CftOX1K01SijjrVNiOAgk79mb6ykFfsNIoTOUU4+JmTxkzN8Y zDtA== X-Gm-Message-State: APzg51DWuGs4gxdJhItb8We+4XSfRRWpVKRoAcJ1fgI1MSXnOxFxNArD YXPBZbMuQQix4HXiYZ9QgxcBtg== X-Google-Smtp-Source: ANB0VdYog2FqbY0wjdkbq9xQ4JnLiYQ89VJjH8I6YeiEdUS+ZH0N0WYWZd/0L5KoYjFTML4R4cYouA== X-Received: by 2002:a24:1c0a:: with SMTP id c10-v6mr4368467itc.101.1537496994654; Thu, 20 Sep 2018 19:29:54 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id k62-v6sm2001040itc.21.2018.09.20.19.29.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Sep 2018 19:29:54 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 425BD8025FB; Thu, 20 Sep 2018 21:29:53 -0500 (CDT) Date: Thu, 20 Sep 2018 21:29:53 -0500 From: Justin Pryzby To: Vladimir Ryabtsev Cc: pgsql-performance@lists.postgresql.org Subject: Re: Why could different data in a table be processed with different performance? Message-ID: <20180921022953.GE2471@telsasoft.com> References: <20180921004232.GC2471@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Sorry, dropped -performance. >>>> Has the table been reindexed (or pg_repack'ed) since loading (or vacuumed >>>> for that matter) ? >>> Not sure what you mean... We created indexes on some fields (on >> I mean REINDEX INDEX articles_pkey; >> Or (from "contrib"): /usr/pgsql-10/bin/pg_repack -i articles_pkey >I never did it... Do you recommend to try it? Which variant is preferable? REINDEX is likely to block access to the table [0], and pg_repack is "online" (except for briefly acquiring an exclusive lock). [0] https://www.postgresql.org/docs/10/static/sql-reindex.html >>>> You can see the index scan itself takes an additional 11sec, the "heap" >>>> portion takes the remaining, additional 14sec (33s-12s-7s). >>> Sorry, I see 33 s total and 12 s for index, where do you see 7 s? >> 6625 ms (for short query). >> So the heap component of the long query is 14512 ms slower. > Yes, I see, thanks. > So reindex can help only with index component? What should I do for heap? > May be reindex the corresponding toast table? I think reindex will improve the heap access..and maybe the index access too. I don't see why it would be bloated without UPDATE/DELETE, but you could check to see if its size changes significantly after reindex. Justin