From: | Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz> |
---|---|
To: | pginfo <pginfo(at)t1(dot)unisoftbg(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Trigger performance |
Date: | 2004-01-23 07:35:27 |
Message-ID: | Pine.LNX.4.44.0401230834030.10349-100000@kix.fsv.cvut.cz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Hello
try prepared statements, PQexecPrepared
http://developer.postgresql.org/docs/postgres/libpq-exec.html
Regards
Pavel Stehule
On Thu, 22 Jan 2004, pginfo wrote:
> Hi,
>
> thanks for the answer.
> It is very interest, because I readet many times that if I write the trigger
> in "C" it will work faster.
> In wich case will this trigger work faster if write it in "C"?
> In all my triggres I have "select ...." or "insert into mytable select ..."
> or "update mytable set ...where...".
> I need this info because I have a table with ~1.5 M rows and if I start to
> update 300 K from this rows it takes ~ 2h.
> If I remove the trigger for this table all the time is ~ 1 min.
>
> regards,
> ivan.
>
> Tom Lane wrote:
>
> > pginfo <pginfo(at)t1(dot)unisoftbg(dot)com> writes:
> > > I was supprised that the pgsql trigger take ~8 sec. to insert this rows
> > > and the "C" trigger take ~ 17 sec.
> >
> > The reason is that plpgsql caches the plan for the invoked SELECT,
> > whereas the way you coded the C function, it's re-planning that SELECT
> > on every call.
> >
> > regards, tom lane
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> > (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
>
From | Date | Subject | |
---|---|---|---|
Next Message | Arnau Rebassa i Villalonga | 2004-01-23 07:50:02 | Queries with timestamp, 2 |
Previous Message | Greg Stark | 2004-01-23 00:20:25 | Re: database performance and query performance question |