Re: Change definitions of bitmap flags to bit-shifting style

2020-12-05 Thread Michael Paquier
On Sat, Dec 05, 2020 at 10:31:09PM -0300, Alvaro Herrera wrote: > The hexadecimal representation is more natural to me than bit-shifting, > so I would prefer to use that style too. But maybe I'm trained to it > because of looking at t_infomask symbols constantly. If we are going to change all tha

Re: Change definitions of bitmap flags to bit-shifting style

2020-12-05 Thread Laurenz Albe
On Sat, 2020-12-05 at 13:03 -0500, Tom Lane wrote: > Peter Eisentraut writes: > > > The attached patch changes definitions like > > #define FOO 0x01 > > #define BAR 0x02 > > to > > #define FOO (1 << 0) > > #define BAR (1 << 1) > > etc. > > > Both styles are currently in u

Re: [PATCH] Keeps tracking the uniqueness with UniqueKey

2020-12-05 Thread Andy Fan
Thank you Tom and Heikki for your input. On Sun, Dec 6, 2020 at 4:40 AM Tom Lane wrote: > Heikki Linnakangas writes: > >> I can understand why we need EquivalenceClass for UniqueKey, but I can't > >> understand why we need opfamily here. > > > Thinking a bit harder, I guess we don't. Because Eq

Re: A few new options for CHECKPOINT

2020-12-05 Thread Alvaro Herrera
On 2020-Dec-05, Stephen Frost wrote: > So- just to be clear, CHECKPOINTs are more-or-less always happening in > PG, and running this command might do something or might end up doing > nothing depending on if a checkpoint is already in progress and this > request just gets consolidated into an exis

Re: Change definitions of bitmap flags to bit-shifting style

2020-12-05 Thread Alvaro Herrera
On 2020-Dec-05, Tom Lane wrote: > FWIW, personally I'd vote for doing the exact opposite. When you are > debugging and examining the contents of a bitmask variable, it's easier to > correlate a value like "0x03" with definitions made in the former style. > Or at least I think so; maybe others see

Re: [PATCH] Keeps tracking the uniqueness with UniqueKey

2020-12-05 Thread Tom Lane
Heikki Linnakangas writes: >> I can understand why we need EquivalenceClass for UniqueKey, but I can't >> understand why we need opfamily here. > Thinking a bit harder, I guess we don't. Because EquivalenceClass > includes the operator family already, in the ec_opfamilies field. No. Equivalenc

Re: Index Skip Scan (new UniqueKeys)

2020-12-05 Thread Thomas Munro
On Wed, Dec 2, 2020 at 9:59 AM Heikki Linnakangas wrote: > On 01/12/2020 22:21, Dmitry Dolgov wrote: > >> On Mon, Nov 30, 2020 at 04:42:20PM +0200, Heikki Linnakangas wrote: > >> - I'm surprised you need a new index AM function (amskip) for this. Can't > >> you just restart the scan with index_res

Re: should INSERT SELECT use a BulkInsertState?

2020-12-05 Thread Justin Pryzby
On Thu, Dec 03, 2020 at 10:59:34AM +0530, Bharath Rupireddy wrote: > On Wed, Dec 2, 2020 at 10:24 PM Justin Pryzby wrote: > > > > One loose end in this patch is how to check for volatile default > > expressions. > > I think we should be doing all the necessary checks in the planner and > have a

Re: [PATCH] Keeps tracking the uniqueness with UniqueKey

2020-12-05 Thread Heikki Linnakangas
On 05/12/2020 17:10, Andy Fan wrote: Actually I can't understand this, could you explain more?  Based on my current knowledge,  when we run "SELECT DISTINCT a FROM t",  we never care about which operator to use for the unique. SortGroupClause includes 'eqop' field, which determines the opera

Re: Change definitions of bitmap flags to bit-shifting style

2020-12-05 Thread Tom Lane
Peter Eisentraut writes: > The attached patch changes definitions like > #define FOO 0x01 > #define BAR 0x02 > to > #define FOO (1 << 0) > #define BAR (1 << 1) > etc. > Both styles are currently in use, but the latter style seems more > readable and easier to update. FWIW, p

Re: Index Skip Scan (new UniqueKeys)

2020-12-05 Thread Dmitry Dolgov
> On Tue, Dec 01, 2020 at 10:59:22PM +0200, Heikki Linnakangas wrote: > > > > - Does this optimization apply to bitmap index scans? > > > > No, from what I understand it doesn't. > > Would it be hard to add? Don't need to solve everything in the first > version of this, but I think in principle you

Re: A few new options for CHECKPOINT

2020-12-05 Thread Stephen Frost
Greetings, * Bossart, Nathan (bossa...@amazon.com) wrote: > On 12/5/20, 6:41 AM, "Stephen Frost" wrote: > > Assuming we actually want to do this, which I still generally don't > > agree with since it isn't really clear if it'll actually end up doing > > something, or not, wouldn't it make more se

Re: A few new options for CHECKPOINT

2020-12-05 Thread Bossart, Nathan
On 12/5/20, 6:41 AM, "Stephen Frost" wrote: > Assuming we actually want to do this, which I still generally don't > agree with since it isn't really clear if it'll actually end up doing > something, or not, wouldn't it make more sense to have a command that > just sits and waits for the currently

Re: automatic analyze: readahead - add "IO read time" log message

2020-12-05 Thread Stephen Frost
Greetings, * Tomas Vondra (tomas.von...@enterprisedb.com) wrote: > Thanks. I'll do some testing/benchmarking once my machines are free, in > a couple days perhaps. But as I said before, I don't expect this to > behave very differently from other places that already do prefetching. Agreed, but wou

Re: Proposed patch for key managment

2020-12-05 Thread Bruce Momjian
On Sat, Dec 5, 2020 at 09:54:33PM +0900, Michael Paquier wrote: > On Fri, Dec 04, 2020 at 10:52:29PM -0500, Bruce Momjian wrote: > > OK, I worked with Sawada-san and added the attached patch. The updated > > full patch is at the same URL: :-) > > > > https://github.com/postgres/postgres/com

Change definitions of bitmap flags to bit-shifting style

2020-12-05 Thread Peter Eisentraut
The attached patch changes definitions like #define FOO 0x01 #define BAR 0x02 to #define FOO (1 << 0) #define BAR (1 << 1) etc. Both styles are currently in use, but the latter style seems more readable and easier to update. This change only addresses bitmaps used in memory

Re: [PATCH] Keeps tracking the uniqueness with UniqueKey

2020-12-05 Thread Andy Fan
Thank you Heikki for your attention. On Mon, Nov 30, 2020 at 11:20 PM Heikki Linnakangas wrote: > On 30/11/2020 16:30, Jesper Pedersen wrote: > > On 11/30/20 5:04 AM, Heikki Linnakangas wrote: > >> On 26/11/2020 16:58, Andy Fan wrote: > >>> This patch has stopped moving for a while, any suggest

Re: Hybrid Hash/Nested Loop joins and caching results from subplans

2020-12-05 Thread Andy Fan
Thanks for working on the new version. On Fri, Dec 4, 2020 at 10:41 PM David Rowley wrote: > > I also > noticed that the code I'd written to build the cache lookup expression > included a step to deform the outer tuple. This was unnecessary and > slowed down the expression evaluation. > > I thou

Re: A few new options for CHECKPOINT

2020-12-05 Thread Stephen Frost
Greetings, * Bossart, Nathan (bossa...@amazon.com) wrote: > This all seems reasonable to me. I've attached a new version of the > patch. diff --git a/doc/src/sgml/ref/checkpoint.sgml b/doc/src/sgml/ref/checkpoint.sgml index 2afee6d7b5..2b1e56fbd7 100644 --- a/doc/src/sgml/ref/checkpoint.sgml +++

Re: Proposed patch for key managment

2020-12-05 Thread Michael Paquier
On Fri, Dec 04, 2020 at 10:52:29PM -0500, Bruce Momjian wrote: > OK, I worked with Sawada-san and added the attached patch. The updated > full patch is at the same URL: :-) > > https://github.com/postgres/postgres/compare/master...bmomjian:key.diff Oh, I see that you use SHA256 during fir

Re: Add session statistics to pg_stat_database

2020-12-05 Thread Laurenz Albe
On Fri, 2020-12-04 at 16:55 +0100, I wrote: > > > Basically, that would change pgStatSessionDisconnectedNormally into > > > instead being an > > > enum of reasons, which could be normal disconnect, abnormal disconnect > > > and admin. > > > And we'd track all those three as separate numbers in th

Re: Proposed patch for key managment

2020-12-05 Thread Masahiko Sawada
On Sat, 5 Dec 2020 at 11:08, Bruce Momjian wrote: > > On Wed, Dec 2, 2020 at 04:38:14PM -0500, Bruce Momjian wrote: > > If most people approve of this general approach, and the design > > decisions made, I would like to apply this in the next few weeks, but > > this brings complications. The syn

Re: Parallel Inserts in CREATE TABLE AS

2020-12-05 Thread Amit Kapila
On Mon, Nov 30, 2020 at 10:43 AM Bharath Rupireddy wrote: > > On Fri, Nov 27, 2020 at 1:07 PM Luc Vlaming wrote: > > > > Disclaimer: I have by no means throughly reviewed all the involved parts > > and am probably missing quite a bit of context so if I understood parts > > wrong or they have been