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 1iHDYX-0001yK-Mu for pgsql-performance@arkaria.postgresql.org; Sun, 06 Oct 2019 20:55:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iHDYW-00082z-9W for pgsql-performance@arkaria.postgresql.org; Sun, 06 Oct 2019 20:55:04 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iHDYW-00082s-0I for pgsql-performance@lists.postgresql.org; Sun, 06 Oct 2019 20:55:04 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iHDYO-0006Et-Dv for pgsql-performance@postgresql.org; Sun, 06 Oct 2019 20:55:02 +0000 Received: by mail-wr1-x443.google.com with SMTP id h4so4116722wrv.7 for ; Sun, 06 Oct 2019 13:54:55 -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=szupWojYyMBpbdqCV04uq/nGUvz5YYW+5SIToYRm1kU=; b=VWZICWZE7aVkW7mYTczU9D8lueXdJxC7MBoeWo1Vark1dHxVYJGsEVWQSiqLg0jwKg DtpUTR5JstRO6Fh/LCITUKbYYXw5r8g+wR4YIdK5ESqDgvWnsqGy3TR1ywb+3fJpuSTG 3gEQ0zWdY5e7oSgalVTiwiMkmi43LgVX9JLcZGcN/56Kb4dbGfFfXvjjYiJc4ydkUJJT qE7Io1Zu0DZkJ1aF6/DdP7I/Ax3qBVGSCXBrVLc/YndtgyV7EG8h+ArEN16227xhZUqo gcrF9F3EZXMZD2cvwTDf17x2EQMLMuG4cEnw/KD6BPh5fDbUQCfx2N08/y5snBrS7amt LlBQ== 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=szupWojYyMBpbdqCV04uq/nGUvz5YYW+5SIToYRm1kU=; b=JweT4LwC7mJHzGPYC1QgN7UV1mXV+WIB130FtUDGiPF0yKMYUZL+kp2su5/4qEuvjc W0wDP2vLKjm++8cTmOPNCgS874QucGqHSPQLryd1VCSczZUQXqi72c3IyjG/VA0pS29F k3/O8s3PzMPJhxmQn4hUIn5KijrbC1MylGPNJF2/2lh87fCW+LRozZPPiaqPKJzv5nqe P+P1OpY3Vwqkqu7Q7MtPvWzCwB4yNQF1UE8Cg7xVhdIrSmqWfvSp1IfJwDl7IuUlU6E6 +biCasBMVeD4LYJuSSZrLysxEupTltpf5tbJDOIUhyFZZf6YId1Itrh2t3wW961r6h3z /niw== X-Gm-Message-State: APjAAAUZ4yy4pn8w+/FSt7sr9DH/MAdJyX4gsPZF8yQga0XqeC624dVP jCs/gkmRfHU+CS8ATbIhYQculA== X-Google-Smtp-Source: APXvYqw0SyfbQ+xzUVS+QVLOrtGfNL7MKmOV7XbwKP15bVqyX4sdfstDHFfQgEQkvqrh9r/wuvuyTQ== X-Received: by 2002:a5d:50c8:: with SMTP id f8mr16384004wrt.96.1570395293975; Sun, 06 Oct 2019 13:54:53 -0700 (PDT) Received: from localhost (ip-86-49-253-183.net.upcbroadband.cz. [86.49.253.183]) by smtp.gmail.com with ESMTPSA id i7sm4882513wrm.87.2019.10.06.13.54.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Oct 2019 13:54:53 -0700 (PDT) Date: Sun, 6 Oct 2019 22:54:52 +0200 From: Tomas Vondra To: Joao Junior Cc: pgsql-performance@postgresql.org Subject: Re: Delete huge Table under XFS Message-ID: <20191006205452.5vx3qqxwjbxc6jzh@development> References: <357e7bd3-1b40-180c-14ce-7911229b5efb@a-kretschmer.de> 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 Thu, Sep 19, 2019 at 07:00:01PM +0200, Joao Junior wrote: >A table with 800 gb means 800 files of 1 gb. When I use truncate or drop >table, xfs that is a log based filesystem, will write lots of data in its >log and this is the problem. The problem is not postgres, it is the way >that xfs works with big files , or being more clear, the way that it >handles lots of files. > I'm a bit skeptical about this explanation. Yes, XFS has journalling, but only for metadata - and I have a hard time believing deleting 800 files (or a small multiple of that) would write "lots of data" into the jornal, and noticeable performance issues. I wonder how you concluded this is actually the problem. That being said, TRUNCATE is unlikely to perform better than DROP, because it also deletes all the files at once. What you might try is dropping the indexes one by one, and then the table. That should delete files in smaller chunks. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services