Re: Trouble with bytea in SPI...

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Cristian Prieto <cristian(at)clickdiario(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Trouble with bytea in SPI...
Date: 2005-09-02 21:01:51
Message-ID: 20050902210151.GN29066@surnet.cl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Sep 02, 2005 at 12:17:09PM -0600, Cristian Prieto wrote:

Hey Cristian,

> Right now it works just with one field and I guess it is working well, but
> I am very worried about the performance of SPI_execute() and SPI_execp(). I
> read in the Developer FAQ something about accessing the data directly from
> the backend code. If it is like this I would like to get more infor about
> how to use SearchSysCache() and heap_beginscan().
>
> Do you think I need to implement such thing to improve performance? any
> idea in how to improve my approach to this trouble?

While SPI does impose some overhead, code-wise it is certainly
appropiate for what you are doing. SearchSysCache() and the like is
reserved for system catalogs, and I don't think you want to recompile
the whole of Postgres just to get some improvement there. No need to
mention the fact that your Postgres would be incompatible with everyone
else's, and un-backup-able. Certainly not a road I'd go.

Using heap_beginscan et al would be almost the same as using SPI. I
doubt there's a lot of performance to be gained that way ... or maybe
there is, but you'd pay in maintenability and obscure bugs, and you'll
lose the future improvements to the optimizer, etc.

Just be sure to use VACUUM and ANALYZE appropiately, keep well defined
indexes, and you shouldn't need much else.

--
Alvaro Herrera -- Valdivia, Chile Architect, www.EnterpriseDB.com
"The important things in the world are problems with society that we don't
understand at all. The machines will become more complicated but they won't
be more complicated than the societies that run them." (Freeman Dyson)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Matt Miller 2005-09-02 21:09:01 Re: Ora2Pg (was PL/pgSQL: EXCEPTION NOSAVEPOINT)
Previous Message Poul Møller Hansen 2005-09-02 20:39:14 Re: Check if SELECT is granted