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.92) (envelope-from ) id 1jI39i-0006CR-Ux for pgsql-performance@arkaria.postgresql.org; Sat, 28 Mar 2020 04:33:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jI39g-0005We-Oa for pgsql-performance@arkaria.postgresql.org; Sat, 28 Mar 2020 04:33:08 +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 1jI39g-0005Vm-CB for pgsql-performance@lists.postgresql.org; Sat, 28 Mar 2020 04:33:08 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jI39Y-0005O0-B2 for pgsql-performance@postgresql.org; Sat, 28 Mar 2020 04:33:06 +0000 Received: by mail-wm1-x342.google.com with SMTP id f6so8361422wmj.3 for ; Fri, 27 Mar 2020 21:32:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=WfG5wytTsAAqtJdG70tFVNGxVtefhk6jmreXYaKRpQc=; b=VZjl+TWEg5rmfLCsJsJBQd1Deub39piEF9SXWnCNoGULwW748X0a+EK9CsokF03ghi 7LPMRHKkmq8aGdFmck3wJVGf+1G9O8e8NWFE+9/dUKmvP4GxK7aNjoQ84WLAL2kTlLIH 5egCoYa1gjNUU1u5yqJ+iRPKbFKL35Jw+Mg2rXBqZ7AvYO+szLg5xoiLY5h1XinXVNh0 6ntkuchqz96+QC/UbEGebJJvDVcOTM5zLcwVuNyUKouuIcfvYzJ9WDCHuDjWlRFsGUAO MwjWyEpEGyS9HA6UhjuOXw3UjroL2ccLUJtQXt5lvdv827mw5V/08v2nipPW2xTgQO9V UB1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=WfG5wytTsAAqtJdG70tFVNGxVtefhk6jmreXYaKRpQc=; b=gamkTl5kdFNMKnC4Tvkvt5zQ7AufDOIotK5Zhe1VUQQYPntOoqspyM5y2ZJDLe03/g Mg/PgI+wGrtHC87/6fGKnjAXNR5QL8ACcSvq651mNmvrOsTN9KQYQloIMFlfiVS+rXfJ rnLP9hCAys0hKjrbv0WPS1JacEz25GKDRtSi8w/zPXGZG18RCy9pce0hYUbvHR9Jmq/x oOHJuW33rSadEr3CTscB/vkBnzz9lqIs4DuGCvNTdZdCARlG8fsZo9a38b0AxX158hPw KghqaWLrjYThE+Z0AK349DZqIoRNT7xIDjKI35yMP44LqXXtW920oom/pMnXm/p2IZzC Drug== X-Gm-Message-State: ANhLgQ2q104ScVn2BY5yNa6N80Z3o90XWGBMKhcDotbW7ZOaEA4QTD+c ZUgoDZ665HA+G5Rf1Je5+GiaDg== X-Google-Smtp-Source: ADFU+vuZ0r6ceWVWtbUOIn2YrYFbX+E8gN20wXNxt6aMPwbtPrIDLr7KCB3bAhGTBQ7Y6T0Q/wceJA== X-Received: by 2002:a1c:7412:: with SMTP id p18mr2019335wmc.46.1585369978561; Fri, 27 Mar 2020 21:32:58 -0700 (PDT) Received: from dynamic-epw5e0skjbp1ln75x-pd01.res.v6.highway.a1.net (dynamic-epw5e0skjbp1ln75x-pd01.res.v6.highway.a1.net. [2001:871:60:e688:1212:bc31:c55d:ad05]) by smtp.gmail.com with ESMTPSA id u11sm11089228wrt.29.2020.03.27.21.32.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 21:32:58 -0700 (PDT) Message-ID: Subject: Re: Best way to delete big amount of records from big table From: Laurenz Albe To: Ekaterina Amez Cc: postgres performance list Date: Sat, 28 Mar 2020 05:32:57 +0100 In-Reply-To: References: <6e456b07-a396-f9e3-6a22-23a96b73420c@zunibal.com> <5e44d4e8ae73193efa82fb2744dbd95cc5130669.camel@cybertec.at> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, 2020-03-27 at 16:15 +0100, Ekaterina Amez wrote: > > You should define primary and foreign keys if you can, but I guess > > I don't have to tell you that. > > Excuse me if this is a silly question but I've read (or understood) that it's better > to remove constraints to improve delete performance... this is related to indexes only? or also to PK-FK? I meant, add constraints *after* you are done cleaning up. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com