Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krFuo-0004YM-Ms for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Dec 2020 07:47:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1krFun-0002he-H3 for pgsql-hackers@arkaria.postgresql.org; Mon, 21 Dec 2020 07:47:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1krFun-0002hX-6G for pgsql-hackers@lists.postgresql.org; Mon, 21 Dec 2020 07:47:33 +0000 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1krFuj-0007kr-HZ for pgsql-hackers@postgresql.org; Mon, 21 Dec 2020 07:47:31 +0000 Received: by mail-il1-x135.google.com with SMTP id w12so8038549ilm.12 for ; Sun, 20 Dec 2020 23:47:29 -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:in-reply-to:user-agent; bh=qE6yTXVYYbFS7EjDi/hRODBxJ/rbhrO1hK9mvw2TnEY=; b=Q9gJHz8JWO6JaV/8PFqricTCgmjigHihiBI9Mh1vRw6KQTUVqxok8bFhZe1DtAhWJV f75t3j70Urm7OfeJsC80wFNBLBku1dStJQcCVyKG2OF6PbhwXNeBc2xpdnEq4L5sA7qV 3E+W6BJHBvi5fpfSyWenx4O250HJsnGeRqWLFR/mvjezZVmp8Z7zsHQILIrwwl9I9YR/ +WorDNt4m6OCG5CbPAZlT0kH3VcrFEPoTYG/DFkkqB4kDsXOXMVlV+Odzxg/gm6AB3oM ExHkhiXqL4/t2W1W7j8rbjpwOCHe4U42in55I7H77AXwSZsq/AfCRaQ6+U34eSghQEMN qN5w== 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=qE6yTXVYYbFS7EjDi/hRODBxJ/rbhrO1hK9mvw2TnEY=; b=JzQuOiNk8Jk1F+tLiBlw8GaOVSheNJOJEQsRf7noeErT+Pt7pPPOEhJyMlVFtls3+R DQ7i97C43WltvntKYJjfUG2TZGyI2NTUOuqTGfX4rwIfSxi+26wsK48ZHZlaC9Q5ynva JKozl3FhooiJoVZI9t68au3OPQrWAyMWm7AavDicB4epwP2dw0bcEq7OXUmOCHeCa0Kl Z5PsHtDQtjYxH/ZgvEbemY5GHgrcEaJUVLyZokwxOIK/GcKOR7kf/BHK5puXDL5T0ftO p7Jc9Gp83IpKQaJQe8HFIjGwoLZ4SrvbsUbMFMki7imDZsA5iIUTDlc8gAlcWut/VXFh 81aw== X-Gm-Message-State: AOAM532xIwxhnccaKsq2xktMTUNSWzD04xdxBeUSmbNx9Ls5XGS1PCy6 c0CvzTM4eweDZPPIjkJFVG2IPg== X-Google-Smtp-Source: ABdhPJzrkWNOIyiUTOlldk53iZgH51S/moY9CGvPsBUEIfMozL/YTpouh43kImS3UfFcQkCXb5zp2g== X-Received: by 2002:a92:5a57:: with SMTP id o84mr15696060ilb.155.1608536848382; Sun, 20 Dec 2020 23:47:28 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id n11sm8708382ioh.37.2020.12.20.23.47.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 Dec 2020 23:47:27 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 8629E800842; Mon, 21 Dec 2020 01:47:25 -0600 (CST) Date: Mon, 21 Dec 2020 01:47:25 -0600 From: Justin Pryzby To: Bharath Rupireddy Cc: PostgreSQL-development , Andres Freund , Luc Vlaming , Paul Guo Subject: Re: New Table Access Methods for Multi and Single Inserts Message-ID: <20201221074725.GF30237@telsasoft.com> References: <20201217050522.GU30237@telsasoft.com> <20201217204442.GX30237@telsasoft.com> <20201218175439.GA30237@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201218175439.GA30237@telsasoft.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Dec 18, 2020 at 11:54:39AM -0600, Justin Pryzby wrote: > On Fri, Dec 18, 2020 at 07:39:14AM +0530, Bharath Rupireddy wrote: > > On Fri, Dec 18, 2020 at 2:14 AM Justin Pryzby wrote: > > > Are you thinking that TableInsertState would eventually have additional > > > attributes which would apply to other tableams, but not to heap ? Is > > > heap_insert_begin() really specific to heap ? It's allocating and populating a > > > structure based on its arguments, but those same arguments would be passed to > > > every other AM's insert_begin routine, too. Do you need a more flexible data > > > structure, something that would also accomodate extensions? I'm thinking of > > > reloptions as a loose analogy. > > > > I could not think of other tableam attributes now. But +1 to have that > > kind of flexible structure for TableInsertState. So, it can have > > tableam type and attributes within the union for each type. > > Right now you have heap_insert_begin(), and I asked if it was really > heap-specific. Right now, it populates a struct based on a static list of > arguments, which are what heap uses. > > If you were to implement a burp_insert_begin(), how would it differ from > heap's? With the current API, they'd (have to) be the same, which means either > that it should apply to all AMs (or have a "default" implementation that can be > overridden by an AM), or that this API assumes that other AMs will want to do > exactly what heap does, and fails to allow other AMs to implement optimizations > for bulk inserts as claimed. > > I don't think using a "union" solves the problem, since it can only accommodate > core AMs, and not extensions, so I suggested something like reloptions, which > have a "namespace" prefix (and core has toast.*, like ALTER TABLE t SET > toast.autovacuum_enabled). I think you'd want to handle things like: - a compressed AM wants to specify a threshold for a tuple's *compressed* size (maybe in addition to the uncompressed size); - a "columnar" AM wants to specify a threshold size for a column, rather than for each tuple; I'm not proposing to handle those specific parameters, but rather pointing out that your implementation doesn't allow handling AM-specific considerations, which I think was the goal. The TableInsertState structure would need to store those, and then the AM's multi_insert_v2 routine would need to make use of them. It feels a bit like we'd introduce the idea of an "AM option", except that it wouldn't be user-facing (or maybe some of them would be?). Maybe I've misunderstood though, so other opinions are welcome. -- Justin