Re: [GENERAL] Listen/notify, equivalents on other DBs

2015-09-26 Thread Thomas Kellerer
Mark Morgan Lloyd schrieb am 25.09.2015 um 23:41: I'm trying to get support for PostgreSQL's listen/notify into a development environment, but since it supports multiple database backends: can anybody comment on how many other servers have a comparable facility? Minimal research has allowed me

[GENERAL] How to speed up delete where not in

2015-09-26 Thread Andrus
Hi! I'm looking for a way to delete records which do not have child rows on big tables where lot of rows needs to be deleted. Both tables have lot of other foreign key references. Document headers are in omdok table: create table omdok ( dokumnr serial primary key, ... ); Document

Re: [GENERAL] How to speed up delete where not in

2015-09-26 Thread David Rowley
On 26 September 2015 at 19:53, Andrus wrote: > Hi! > > > I'm looking for a way to delete records which do not have child rows on > big tables where lot of rows needs to be deleted. Both tables have lot of > other foreign key references. > > > Document headers are in omdok

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-26 Thread Pavel Stehule
2015-09-26 19:59 GMT+02:00 Tom Lane : > Pavel Stehule writes: > > 2015-09-26 19:53 GMT+02:00 Nikolai Zhubr : > >> And the events of session start and session end would seem quite generic > >> and usefull anyway? > > > I don't

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-26 Thread Tom Lane
Pavel Stehule writes: > 2015-09-26 19:59 GMT+02:00 Tom Lane : >> A session-start hook is already possible at the C-code level, using >> session_preload_libraries. It wouldn't be hard to write an extension >> that exposed that in some useful way to SQL

[GENERAL] Server-side hooks for user session start and session end

2015-09-26 Thread Nikolai Zhubr
Hi all, I'm trying to find a soultion to automatically execute something (preferrably a function or at least some pure sql statements) at the beginning and at the end of a user session. As an example, imagine just storing of all login and logout timestamps (though the real task is a bit more

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-26 Thread Pavel Stehule
2015-09-26 18:17 GMT+02:00 Nikolai Zhubr : > Hi all, > > I'm trying to find a soultion to automatically execute something > (preferrably a function or at least some pure sql statements) at the > beginning and at the end of a user session. As an example, imagine just > storing

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-26 Thread Nikolai Zhubr
Hi Pavel, 26.09.2015 19:26, Pavel Stehule wrote: [...] This cannot be solved without patching PostgreSQL source code :( . There are not good hooks for custom extension. Patch is relative simple, but I cannot to publish it. Ok, I see. Creating such a patch might be not very hard actually. But

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-26 Thread Pavel Stehule
2015-09-26 20:29 GMT+02:00 Tom Lane : > Pavel Stehule writes: > > 2015-09-26 19:59 GMT+02:00 Tom Lane : > >> A session-start hook is already possible at the C-code level, using > >> session_preload_libraries. It wouldn't be hard

Re: [GENERAL] How to speed up delete where not in

2015-09-26 Thread Melvin Davidson
In addition to the previous recommendation, make sure you have an index on dokumnr in table omrid. EG: CREATE INDEX omrid_dokumnr_fk ON omrid USING BTREE (dokumnr); On Sat, Sep 26, 2015 at 7:33 AM, David Rowley wrote: > On 26 September 2015 at 19:53, Andrus

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-26 Thread Nikolai Zhubr
26.09.2015 20:59, Tom Lane wrote: [...] A session-end hook seems pretty problematic to me: you simply cannot guarantee that it will run at all. (Consider process crash or server abort cases.) So anything built on the assumption that it gets to run at session end is going to be inherently

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-26 Thread Pavel Stehule
2015-09-26 19:53 GMT+02:00 Nikolai Zhubr : > Hi Pavel, > 26.09.2015 19:26, Pavel Stehule wrote: > [...] > >> This cannot be solved without patching PostgreSQL source code :( . There >> are not good hooks for custom extension. Patch is relative simple, but I >> cannot to

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-26 Thread David G. Johnston
On Saturday, September 26, 2015, Tom Lane wrote: > Pavel Stehule > writes: > > 2015-09-26 19:53 GMT+02:00 Nikolai Zhubr >: > >> And the events of session start and session end would seem quite generic

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-26 Thread Pavel Stehule
> >> > years ago I tried it, if I remember well. I had a problems with SPI >> calls, >> > because some caches was not initialized. I am not sure, and I didn't >> test >> > last time. >> >> You'd have to start your own transaction if you wanted one, and any >> uncaught error would effectively be

Re: [GENERAL] Server-side hooks for user session start and session end

2015-09-26 Thread Tom Lane
Pavel Stehule writes: > 2015-09-26 19:53 GMT+02:00 Nikolai Zhubr : >> And the events of session start and session end would seem quite generic >> and usefull anyway? > I don't know. I am pretty sceptical - from my experience this request was >