From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Kevin Grittner <kevin(dot)grittner(at)wicourts(dot)gov> |
Cc: | Andrew Dunstan <andrew(at)dunslane(dot)net>, Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: How to extract a value from a record using attnum or attname? |
Date: | 2011-02-23 13:46:09 |
Message-ID: | 1298468435-sup-9777@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Excerpts from Kevin Grittner's message of mar feb 22 20:29:26 -0300 2011:
> Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>
> > Have you performance tested it? Scanning pg_index for index
> > columns for each row strikes me as likely to be unpleasant.
>
> I haven't, yet. I had rather assumed that the index info for a
> relation would have a high probability of being cached during
> execution of an AFTER trigger for that relation, so I think we're
> talking RAM access here. It didn't seem sane to try to create an
> HTAB for this and worry about invalidation of it, etc. If there's a
> faster way to get to the info without going to such extremes, I'd be
> happy to hear them. (At least I avoided building and parsing a
> query to get at it.)
I think it'd be better to use RelationGetIndexList (which gets the index
list from relcache) and fetch the index tuples from syscache; see
relationHasPrimaryKey for sample code.
--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
From | Date | Subject | |
---|---|---|---|
Next Message | Geoffrey Myers | 2011-02-23 14:06:14 | Re: Covert database from ASCII to UTF-8 |
Previous Message | Ioana Danes | 2011-02-23 13:41:39 | Re: Logged statement apparently did not commited... |
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2011-02-23 14:46:34 | Re: WIP: cross column correlation ... |
Previous Message | Shigeru HANADA | 2011-02-23 11:30:05 | Re: PostgreSQL FDW update |