Thread: prepared statements & functions
Hi list, AFAI understand prepared statements they can accelerate repetitive queries very much - but is it possible to prepare them from within a function (let say when the user connects), and if so, will they be erased as soon as the user disconnects? JY --
Jean-Yves F. Barbier <12ukwn@gmail.com> wrote: > Hi list, > > AFAI understand prepared statements they can accelerate > repetitive queries very much - but is it possible to > prepare them from within a function (let say when the user > connects), and if so, will they be erased as soon as the > user disconnects? We haven't TRIGGERs for events like 'USER LOGGED IN' or so ... Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was god, I would recompile penguin with --enable-fly." (unknown) Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
On Sun, 4 Dec 2011 09:38:40 +0100 Andreas Kretschmer <akretschmer@spamfence.net> wrote: > > AFAI understand prepared statements they can accelerate > > repetitive queries very much - but is it possible to > > prepare them from within a function (let say when the user > > connects), and if so, will they be erased as soon as the > > user disconnects? > > We haven't TRIGGERs for events like 'USER LOGGED IN' or so ... That was not my thinking; it was more like: user connects user calls the function function creates prepared statements user call other fun that uses these prepared statements JY -- War is menstruation envy.
Jean-Yves F. Barbier <12ukwn@gmail.com> wrote: > On Sun, 4 Dec 2011 09:38:40 +0100 > Andreas Kretschmer <akretschmer@spamfence.net> wrote: > > > > AFAI understand prepared statements they can accelerate > > > repetitive queries very much - but is it possible to > > > prepare them from within a function (let say when the user > > > connects), and if so, will they be erased as soon as the > > > user disconnects? > > > > We haven't TRIGGERs for events like 'USER LOGGED IN' or so ... > > That was not my thinking; it was more like: > user connects > user calls the function > function creates prepared statements > user call other fun that uses these prepared statements Okay, i think, that should be possible. Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was god, I would recompile penguin with --enable-fly." (unknown) Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°
On Mon, Dec 5, 2011 at 11:16 AM, Andreas Kretschmer <akretschmer@spamfence.net> wrote: > Jean-Yves F. Barbier <12ukwn@gmail.com> wrote: > >> On Sun, 4 Dec 2011 09:38:40 +0100 >> Andreas Kretschmer <akretschmer@spamfence.net> wrote: >> >> > > AFAI understand prepared statements they can accelerate >> > > repetitive queries very much - but is it possible to >> > > prepare them from within a function (let say when the user >> > > connects), and if so, will they be erased as soon as the >> > > user disconnects? >> > >> > We haven't TRIGGERs for events like 'USER LOGGED IN' or so ... >> >> That was not my thinking; it was more like: >> user connects >> user calls the function >> function creates prepared statements >> user call other fun that uses these prepared statements > > Okay, i think, that should be possible. also, prepared statements are deallocated automatically when the connection drops. merlin