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 1fwl4o-0004jf-EW for pgsql-performance@arkaria.postgresql.org; Mon, 03 Sep 2018 09:23:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fwl4k-00067T-5N for pgsql-performance@arkaria.postgresql.org; Mon, 03 Sep 2018 09:23:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fwl4j-00067M-Qg for pgsql-performance@lists.postgresql.org; Mon, 03 Sep 2018 09:23:13 +0000 Received: from mail-io0-x242.google.com ([2607:f8b0:4001:c06::242]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fwl4a-0000LM-SF for pgsql-performance@lists.postgresql.org; Mon, 03 Sep 2018 09:23:12 +0000 Received: by mail-io0-x242.google.com with SMTP id y12-v6so15358346ioj.13 for ; Mon, 03 Sep 2018 02:23:04 -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=QUPzfxMY8Cgi8KzGKvzSgKiET8Hso3xJuuT+alT/LPQ=; b=FKs9N2rHr95e8ARFZ2RerDlvjNmPcUfr4Vmkm+goWGXSovRrtE1Ej0T0qkqfMCqFWt W3aCSexxQ6OphJ1smW5+IeyISeoWiq3Txhl8XeX6/Ybop9GRScbC74k0jMWlX2Xsgn3x EVR+yFX9SoTxWuvRsl/+bQPMIgMZlrKZRBfS2KjdiSBJw7i5m7LwBUxvOqRN5OOWIrt2 tudSkekr/2qOXQKt60O/2vlsck73x8HQ8I4sF2pnORi+YwDk2Ht6MXsvgKd/mVz5rruP O2XCzeVwTz9Hxka8f9rxTlrfN3V4WnaUyEgxME8vmlzQs1i3cF8vt2tTbU0j2qXsy5a2 V1ow== 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=QUPzfxMY8Cgi8KzGKvzSgKiET8Hso3xJuuT+alT/LPQ=; b=uGRH/CZaEJRD0DlTq9utVUFYSmNixQE+tOAruoEytC0JGS/TUYRuVfP0iFkjdWI1u1 rPHDnbWnSY0ZK+5QCO6LP2V1cc4AnRDekykEnqJt+u7egpS60/ZyV4+cMP78PVS+Fihx fW9A4GVgQcQy18mirVpMNfbCEFZAgRa4w4kR4RenalbSjFkX21HvXNReY3E6DpetmEcD /jpxaWxFLOGG9xVO7McSh7Yx7L/HPoTe0i1FQuv6ZYxmxPSg1YczoKkTE9odFb/I1yD3 c/86jt+Mt/aHFvQ+QcG8Oc+Jpzd/wH7LaZUPG1mZnCUrn3vtgX/fWX9kcs1Z3iGSxL5/ FSBw== X-Gm-Message-State: APzg51ACdEA5pj/ajyYL2pXpGcMQbK0bpVZXtpN/u5IgXfDPxYeUw2lN ULd2/QynHLTu1hKzeePC1D7eDQ== X-Google-Smtp-Source: ANB0VdaXEHLLzD5ZnC0xBjpTWFdXIqJMS6gcofZQUAJSTlmC6lDx05+4D66szjnYVNdrPJ7kDTGIFA== X-Received: by 2002:a6b:5c19:: with SMTP id z25-v6mr18110966ioh.265.1535966582692; Mon, 03 Sep 2018 02:23:02 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id k187-v6sm6335461itk.27.2018.09.03.02.23.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Sep 2018 02:23:02 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 3FF298059FD; Mon, 3 Sep 2018 04:23:01 -0500 (CDT) Date: Mon, 3 Sep 2018 04:23:01 -0500 From: Justin Pryzby To: Mariel Cherkassky Cc: Andreas Kretschmer , pgsql-performance@lists.postgresql.org Subject: Re: trying to delete most of the table by range of date col Message-ID: <20180903092300.GC11702@telsasoft.com> References: <20180903070624.GA11702@telsasoft.com> <4a0271e9-df9e-680e-9b21-636763cb674f@a-kretschmer.de> 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 On Mon, Sep 03, 2018 at 11:17:58AM +0300, Mariel Cherkassky wrote: > Hi, > I already checked and on all the tables that uses the id col of the main > table as a foreign key have index on that column. > > So, it seems that the second solution is the fastest one. It there a reason > why the delete chunks (solution 4) wasnt faster? I suggest running: SET track_io_timing=on; -- requires superuser explain(ANALYZE,BUFFERS) DELETE [...] https://wiki.postgresql.org/wiki/Slow_Query_Questions Maybe you just need larger shared_buffers ? Justin