Re: force partition pruning

2021-05-11 Thread Vijaykumar Jain
Fair enough. Many thanks for taking time out to follow up and clear my misunderstanding. I’ll not pollute the thread , since OP got what he wanted. But I’ll have to spend more time trying to simulate it with data and reread what you want to say :). But thanks again for clearing that up. On Wed,

Re: ERROR: no known snapshots

2021-05-11 Thread Tom Lane
reg_pg_stef...@perfexpert.ch writes: > it run into an issue with: ERROR:  no known snapshots Hi! This has been reported before, but I'm embarrassed to say that the previous report seems to have fallen between the cracks. I've created a patch [1] that resolves your example as presented. If you're

SV: force partition pruning

2021-05-11 Thread Niels Jespersen
Fra: David Rowley Sendt: 12. maj 2021 02:34 >> >> ok i think i just may be there is very less data , hence no index scan, no >> pruning. >> >> when i try to force seq_scan off, >> > >Unfortunately, no run-time pruning occurred in the above plan. > >The fact that the above plan uses Append made

Re: force partition pruning

2021-05-11 Thread David Rowley
On Wed, 12 May 2021 at 06:33, Vijaykumar Jain wrote: > > ok i think i just may be there is very less data , hence no index scan, no > pruning. > > when i try to force seq_scan off, > > postgres=# set enable_seqscan TO off; > SET > postgres=# explain analyze select * from tprt where tprt.col1 in (

ERROR: no known snapshots

2021-05-11 Thread reg_pg_stefanz
Hi it run into an issue with: ERROR:  no known snapshots It seems to me whenever I use a toasted value in a loop in plpgsql code  I get this error. Originally it happened in a procedure with a loop, without a setting of and explicit storage on the column, eg. extended. I can reproduce the erro

Re: force partition pruning

2021-05-11 Thread Vijaykumar Jain
ok i think i just may be there is very less data , hence no index scan, no pruning. when i try to force seq_scan off, postgres=# set enable_seqscan TO off; SET postgres=# explain analyze select * from tprt where tprt.col1 in (select tbl1.col1 from tbl1 where tbl1.col2 in (1, 2) );

Re: force partition pruning

2021-05-11 Thread Vijaykumar Jain
ok, partitioning - Can PostgreSQL 12 do partition pruning at execution time with subquery returning a list? - Stack Overflow ok forcing hash join off, did not work as th

Re: force partition pruning

2021-05-11 Thread Vijaykumar Jain
Ok. maybe you are in a rush. But I would keep the thread open, to understand what I am not understanding or else, it'll become a habit of converting sql to plpgsql :) Big Guys, It seems, when the table is partitioned by range, it makes use of a nested loop which helps in partition pruning. if the

Re: Sequence gaps after restart

2021-05-11 Thread Tom Lane
Christopher Sumner writes: > I'm using PostgreSQL v. 10.14 via AWS Aurora Serverless. Our users > recently noticed gaps in the primary ids for many of our tables. As I > understand it, this is due to PostgreSQL effectively caching 32 additional > sequence values (hardcoded in sequence.c ) and a

Re: Sequence gaps after restart

2021-05-11 Thread Rob Sargent
On 5/11/21 9:54 AM, Christopher Sumner wrote: Hello. I'm using PostgreSQL v. 10.14 via AWS Aurora Serverless. Our users recently noticed gaps in the primary ids for many of our tables.  As I understand it, this is due to PostgreSQL effectively caching 32 additional sequence values (hardcoded

Re: Sequence gaps after restart

2021-05-11 Thread Magnus Hagander
On Tue, May 11, 2021 at 5:55 PM Christopher Sumner wrote: > > Hello. > > I'm using PostgreSQL v. 10.14 via AWS Aurora Serverless. Our users recently > noticed gaps in the primary ids for many of our tables. As I understand it, > this is due to PostgreSQL effectively caching 32 additional seque

Sequence gaps after restart

2021-05-11 Thread Christopher Sumner
Hello. I'm using PostgreSQL v. 10.14 via AWS Aurora Serverless. Our users recently noticed gaps in the primary ids for many of our tables. As I understand it, this is due to PostgreSQL effectively caching 32 additional sequence values (hardcoded in sequence.c ) and a 'restart' occurs. Losing a

SV: force partition pruning

2021-05-11 Thread Niels Jespersen
> >Sorry, > >I made a major mistake. I somehow saw the period and period_version as the >same. >so, yes partitions are not pruned here. So my suggestion makes no sense. Thats quite ok. I think my plan now is to have a table returning function that executes a query dynamically. The query has a wh

Re: force partition pruning

2021-05-11 Thread Vijaykumar Jain
Sorry, I made a major mistake. I somehow saw the period and period_version as the same. so, yes partitions are not pruned here. So my suggestion makes no sense. *** create table register(period_version text) partition by list ( period_version ); create table register_p1 part