[Rt-devel] Postgres performance issues and some "odd" ways to get
IDs...
Andrew Sullivan
ajs at crankycanuck.ca
Mon Aug 14 12:53:55 EDT 2006
On Tue, Aug 15, 2006 at 01:24:30AM +1000, Matthew Sullivan wrote:
> it was doing (eg: SELECT id from Transactions where oid = <blah>;) ...
I'm pretty sure SearchBuilder was fixed of that mistake some time
ago. (You can also probably solve this by indexing the oid column,
but I strongly suggest against that). Of course, this suggests
you're not using the latest Postgres, because it no longer creates
tables with oid by default; so this query would just fail. I
strongly suggest you upgrade to 8.1 if you can, because it has a
number of performance improvements. And you need the SearchBuilder
upgrade for sure.
> .. is there any reason why you're not SELECTing the next val from the
> sequence and passing that to the insert and returning it .... that way
Better in Postgres to do the INSERT and then select currval() on the
sequence. No, there's no race condition on this; check the
PostgreSQL docs to see why.
A
--
Andrew Sullivan | ajs at crankycanuck.ca
A certain description of men are for getting out of debt, yet are
against all taxes for raising money to pay it off.
--Alexander Hamilton
More information about the Rt-devel
mailing list