Re: partitions vs indexes

2019-10-03 Thread Enrico Thierbach
On 2 Oct 2019, at 22:16, Michael Lewis wrote: "I would like to convert a table with a primary key into a partitioned setup by a column which is not part of the primary key" That isn't possible. The partition key must be contained by the primary key. That is, the primary key could be site_id, i

Re: partitions vs indexes

2019-10-02 Thread Enrico Thierbach
On 2 Oct 2019, at 22:09, Enrico Thierbach wrote: Hello list, I run into some trouble with partitions: I would like to convert a table with a primary key into a partitioned setup by a column which is not part of the primary key. Also, a column might hold a referenece to a parent row. So this

partitions vs indexes

2019-10-02 Thread Enrico Thierbach
Hello list, I run into some trouble with partitions: I would like to convert a table with a primary key into a partitioned setup by a column which is not part of the primary key. Also, a column might hold a referenece to a parent row. So this is my current table setup, slimmed down: CR

Re: Trouble matching a nested value in JSONB entries

2018-07-03 Thread Enrico Thierbach
Oleg, 1 | {"group_id": 1} 2 | {“group_id": 1} 3 | {“group_id": 2} 4 | {“group_id": 3} PS: Please note that I am currently at postgres 9.5. An update, if necessary, would be possible though. Upgrade, please ! I have only master 11beta2 right now: select * from qq where js @> '{"group_id"

Trouble matching a nested value in JSONB entries

2018-06-20 Thread Enrico Thierbach
Hi list, I have some trouble matching a value in a JSONB object against multiple potential matches. Lets say, I have a table with an id, and a metadata JSONB column, which holds data like the following 1 | {"group_id": 1} 2 | {“group_id": 1} 3 | {“group_id": 2} 4 | {“group_i

Re: SELECT .. FOR UPDATE: find out who locked a row

2018-03-20 Thread Enrico Thierbach
-- me at github: https://github.com/radiospiel me at linked.in: https://www.linkedin.com/in/radiospiel ​You probably considered this but the queuing mechanism I use doesn't hold locks on records during processing. Workers claim tasks by locking them, setting a claimed flag of some sort, th

Re: SELECT .. FOR UPDATE: find out who locked a row

2018-03-16 Thread Enrico Thierbach
Thanks Steven, Evidently my second email got lost somewhere along the way- what you're looking for is an extension called 'pgrowlocks': https://www.postgresql.org/docs/10/static/pgrowlocks.html My prior email on that subject is here: https://www.postgresql.org/message-id/20180315220512.GV241

Re: SELECT .. FOR UPDATE: find out who locked a row

2018-03-16 Thread Enrico Thierbach
Hi Melvin, Stephen, hi list, *FWIW, I really don't understand your need to identify the actual rows that are locked. Once you have identified the query that is causing a block (which is usually due to "Idle in Transaction"), AFAIK the only way to remedy the problem is to kill the offending quer

Re: SELECT .. FOR UPDATE: find out who locked a row

2018-03-15 Thread Enrico Thierbach
e at linked.in: https://www.linkedin.com/in/radiospiel On 15 Mar 2018, at 22:12, Melvin Davidson wrote: On Thu, Mar 15, 2018 at 4:48 PM, Stephen Frost wrote: Greetings, * Enrico Thierbach (e...@open-lab.org) wrote: I am using `SELECT * FROM queue ... FOR UPDATE SKIP LOCKED` to implement a

SELECT .. FOR UPDATE: find out who locked a row

2018-03-15 Thread Enrico Thierbach
Hello, I am using `SELECT * FROM queue ... FOR UPDATE SKIP LOCKED` to implement a queueing system. Now I wonder if it is possible, given the id of one of the locked rows in the queue table, to find out which connection/which transaction owns the lock. Any help is greatly appreciated. Than