pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedCreate index on subfield returned by function that returns base type with sub fields
2+ messages / 2 participants
[nested] [flat]
* Create index on subfield returned by function that returns base type with sub fields
@ 2010-12-23 16:53 Desmond Coertzen <patrolliekaptein@gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: Desmond Coertzen @ 2010-12-23 16:53 UTC (permalink / raw)
To: pgsql-performance
Hello,
Is is possible to create an index on a field on a function that returns a
data type that contains subfields?
It is possible to do this:
create index indx_test
on address
(sp_address_text_to_template(address_text))
where (sp_address_text_to_template(address_text)).city_name =
'some_city_on_some_planet';
,but, I would like to create the index without the partial clause to index
results only from sp_address_text_to_template(address_text)).city_name.
Is this possible? How would I write the statement?
Thanks,
Desmond.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Create index on subfield returned by function that returns base type with sub fields
@ 2010-12-23 17:03 Andres Freund <andres@anarazel.de>
parent: Desmond Coertzen <patrolliekaptein@gmail.com>
0 siblings, 0 replies; 2+ messages in thread
From: Andres Freund @ 2010-12-23 17:03 UTC (permalink / raw)
To: pgsql-performance; +Cc: Desmond Coertzen <patrolliekaptein@gmail.com>
Hi,
On Thursday 23 December 2010 17:53:24 Desmond Coertzen wrote:
> Is is possible to create an index on a field on a function that returns a
> data type that contains subfields?
> Is this possible? How would I write the statement?
I am not sure I understood you correctly. Maybe you mean something like that:
test=# CREATE FUNCTION blub(IN int, OUT a int, OUT b int) RETURNS record
IMMUTABLE LANGUAGE sql AS $$SELECT $1+1, $1+2$$;
CREATE FUNCTION
Time: 1.665 ms
test=# CREATE INDEX foo__blub ON foo (((blub(data)).a));
CREATE INDEX
Time: 86.393 ms
Btw, this is the wrong list for this sort of question. The right place would
be -general.
Andres
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2010-12-23 17:03 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-12-23 16:53 Create index on subfield returned by function that returns base type with sub fields Desmond Coertzen <patrolliekaptein@gmail.com>
2010-12-23 17:03 ` Andres Freund <andres@anarazel.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox