Re: Typmod associated with multi-row VALUES constructs - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: Typmod associated with multi-row VALUES constructs
Date
Msg-id CAKFQuwZ7RbLMbB4bzCY9JsGLWJJrFCGqY+91HMcjtj3cEugz0g@mail.gmail.com
Whole thread Raw
In response to Re: Typmod associated with multi-row VALUES constructs  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-hackers
On Mon, Dec 5, 2016 at 9:54 PM, David G. Johnston <david.g.johnston@gmail.com> wrote:
 The concern is that "scan every row" could be very expensive - though in writing this I'm thinking that you'd quickly find a non-match even in a large dataset - and so a less perfect but still valid solution is to simply discard the typemod if there is more than one row. 

​My folly here - and the actual question to ask - is if you are faced with large dataset that does have consistent typmods - is the benefit of knowing what it is and carrying it to the next layer worth the cost of scanning every single row to prove it is consistent?​

My vote would be no - and the only question to ask is whether n = 1 and n > 1 behaviors should differ - to which I'd say no as well - at least in master.  In the back branches the current behavior would be retained if the n = 1 behavior is kept different than the n > 1 behavior which is a worthy trade-off.

David J.

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Adding in docs the meaning of pg_stat_replication.sync_state
Next
From: Fabien COELHO
Date:
Subject: Re: PSQL commands: \quit_if, \quit_unless