Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eUMru-0005rP-Ti for pgsql-performance@arkaria.postgresql.org; Thu, 28 Dec 2017 01:20:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eUMrt-0007EC-LG for pgsql-performance@arkaria.postgresql.org; Thu, 28 Dec 2017 01:20:21 +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.84_2) (envelope-from ) id 1eUMrt-0007DH-BT for pgsql-performance@lists.postgresql.org; Thu, 28 Dec 2017 01:20:21 +0000 Received: from mail-io0-x243.google.com ([2607:f8b0:4001:c06::243]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eUMrl-0002VN-IH for pgsql-performance@lists.postgresql.org; Thu, 28 Dec 2017 01:20:17 +0000 Received: by mail-io0-x243.google.com with SMTP id g70so24343728ioj.6 for ; Wed, 27 Dec 2017 17:20:12 -0800 (PST) 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:content-transfer-encoding:in-reply-to :user-agent; bh=hEpUfnmbne2v3ODujOeK5dfTSR45BPTQ089642ebwyc=; b=Eyak0lc8zK/rQbzAmulHK2ovf+INeelmy21jQdyUJDSDAxM2mf6p3/JXVenXIbhqQA xylW+J9rY5HvX9+CRZnjt0F2dr7+gwh+QS3oYjKP/ZpsJCM3Sh1UJw5yhpcjkAlHwutV xJ2gcIPZC0d4uTQvXqIVrsvKU5PFDFehooDCNCyicLywejZ0rS55mjR/e7WK85/Y/0O7 soS9FCq5gvhkijHOmhT2LHJRYhlLhM6ONOq/H8O/c2VUNWiF7E1CGzKZiLd0SPCVvEVp VBkfY2Co0lK7Ca+W6RcR3wmIxb0lmKtRdh7SfDCPNKjwgdJMfJtXbC3TNlHeTjj6dpkm m2DQ== 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:content-transfer-encoding :in-reply-to:user-agent; bh=hEpUfnmbne2v3ODujOeK5dfTSR45BPTQ089642ebwyc=; b=Qq23f4pyQEUBOxFIaFSr8vSZusq30sb0ol+8fto8ePCuTBbm/mdXaHZpFKouxXQlXG IyhOPOJISsK6thcxNJDzwo7Eg7vjLuZj8XcnxgtaIlp6AHEP3/QztqA24bYcZmMuG8Jy fwe44A+MLIhqF5//yneQfu1c7nhQRSskKRazeoxJIUvJLimJuoUgX7+RwdRcAF+x+p7o 1TV+CP5Vc/CSjL73M+ybRc4J2xAWFf1q0rJS2MEykGGeX2SmCTbn1HPY9x4MGpqZExOp 4f+HZYTlrav0XuVp96X2wRyrGkksdhJ982y6gD4fSHf+nZnTAaIDFCR/sGn/H7GTNMEm MgUQ== X-Gm-Message-State: AKGB3mK8vrZa8XjqXIxKcj7YHvVHru6zfzJhk1UaX6EnDvPkuQHxzCFY XmcM25Bd2HHQPs61U2+qRcuy7Q== X-Google-Smtp-Source: ACJfBovj2DCpJ3oFaicahX6aMyARLEg3Y0/fDpwgt0X43MxHpn3bxM8CxOmkXtjzERMjjviBmJ/mDw== X-Received: by 10.107.131.20 with SMTP id f20mr38965291iod.6.1514424011093; Wed, 27 Dec 2017 17:20:11 -0800 (PST) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id l83sm13910279ioi.79.2017.12.27.17.20.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Dec 2017 17:20:10 -0800 (PST) Received: by pryzbyj (Postfix, from userid 1000) id ACDF880117E; Wed, 27 Dec 2017 19:20:09 -0600 (CST) Date: Wed, 27 Dec 2017 19:20:09 -0600 From: Justin Pryzby To: Robert Blayzor Cc: pgsql-performance@lists.postgresql.org Subject: Re: Table performance with millions of rows (partitioning) Message-ID: <20171228012009.GI4172@telsasoft.com> References: <7DF18AB9-C4A4-4C28-957D-12C00FCB5F71@inoc.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7DF18AB9-C4A4-4C28-957D-12C00FCB5F71@inoc.net> User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Dec 27, 2017 at 07:54:23PM -0500, Robert Blayzor wrote: > Question on large tables… > > When should one consider table partitioning vs. just stuffing 10 million rows into one table? IMO, whenever constraint exclusion, DROP vs DELETE, or seq scan on individual children justify the minor administrative overhead of partitioning. Note that partitioning may be implemented as direct insertion into child tables, or may involve triggers or rules. > I currently have CDR’s that are injected into a table at the rate of over > 100,000 a day, which is large. > > At some point I’ll want to prune these records out, so being able to just > drop or truncate the table in one shot makes child table partitions > attractive. That's one of the major use cases for partitioning (DROP rather than DELETE and thus avoiding any following vacuum+analyze). https://www.postgresql.org/docs/10/static/ddl-partitioning.html#DDL-PARTITIONING-OVERVIEW Justin