From: | Ivan Radovanovic <radovanovic(at)gmail(dot)com> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
Cc: | Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Getting list of supported types in Postgres |
Date: | 2013-08-15 15:33:56 |
Message-ID: | 520CF4E4.6060307@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 08/15/13 17:27, Adrian Klaver napisa:
> On 08/15/2013 08:07 AM, Ivan Radovanovic wrote:
>> On 08/15/13 16:59, Adrian Klaver napisa:
>>> On 08/15/2013 07:53 AM, Ivan Radovanovic wrote:
>>>
>>>>>>
>>>>>> Now I just need to find out which types can be indexed (and which
>>>>>> types
>>>>>> can be part of PK)
>>>>>
>>>>> http://www.postgresql.org/docs/9.2/interactive/indexes.html
>>>>>
>>>>
>>>> doesn't list which types can be indexed and which can't?
>>>
>>> Postgres can handle a variety of indexes including indexing on
>>> expressions, which is why I pointed you to that link.
>>>
>>> To cut to the chase, in the above link at:
>>>
>>> http://www.postgresql.org/docs/9.2/interactive/indexes-opclass.html
>>>
>>> there is this:
>>>
>>> SELECT am.amname AS index_method,
>>> opf.opfname AS opfamily_name,
>>> amop.amopopr::regoperator AS opfamily_operator
>>> FROM pg_am am, pg_opfamily opf, pg_amop amop
>>> WHERE opf.opfmethod = am.oid AND
>>> amop.amopfamily = opf.oid
>>> ORDER BY index_method, opfamily_name, opfamily_operator;
>>>>
>>>>
>>
>> Thanks Adrian, but question was how to decide which types are indexable
>> - query which you sent returns list of operators defined for some types
>> - for example it returns operators for bytea too, and you can't index by
>> bytea,
>
> Actually you can:
>
> CREATE TABLE bytea_test(id int, fld_1 bytea);
>
> test=# \d bytea_test
>
> Table "public.bytea_test"
>
> Column | Type | Modifiers
> --------+---------+-----------
> id | integer |
> fld_1 | bytea |
>
> test=# CREATE INDEX i ON bytea_test (fld_1);
>
> test=# \d bytea_test
> Table "public.bytea_test"
> Column | Type | Modifiers
> --------+---------+-----------
> id | integer |
> fld_1 | bytea |
> Indexes:
> "i" btree (fld_1)
>
>
>
Didn't know that - I just tried on one existing table and it failed on
account of index row too short
ERROR: index row requires 14616 bytes, maximum size is 8191
SQL state: 54000
Although it looked suspicious like it could be solved by defining custom
tablespace (never did that on Postgres so I am not sure if it would
work), I assumed that it is because bytea can't be indexed.
Obviously I learned one more new thing today :-)
Thanks,
Ivan
From | Date | Subject | |
---|---|---|---|
Next Message | Alban Hertroys | 2013-08-15 15:49:21 | Re: Getting list of supported types in Postgres |
Previous Message | Adrian Klaver | 2013-08-15 15:27:15 | Re: Getting list of supported types in Postgres |