From: | Thomas Boussekey <thomas(dot)boussekey(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | David Gauthier <dfgpostgres(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Indexing fragments of a column's value ? |
Date: | 2023-11-03 21:07:58 |
Message-ID: | CALUeYme=c_nvpJFoJSVhC1yLkL8EpjfnvbGpq=p5FF-nxGVmgw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Le ven. 3 nov. 2023 à 21:01, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> a écrit :
> David Gauthier <dfgpostgres(at)gmail(dot)com> writes:
> > I'm asking about the possibility of indexing portions of a column's value
> > where the column has a static field format.
>
> GIN indexes are meant for exactly that. You might have to write your
> own opclass to break up the input values in the way you want though.
>
> A less difficult answer would be to write a function that breaks up
> the input into (say) an array of text and then use the existing
> GIN array support. But you'd pay for that by needing to write more
> complicated queries to use the index.
>
> regards, tom lane
>
>
> Hello David,
Reading your mail, it seems that your data column contains 3 different
kinds of atomic information:
* Characters 1-2
* Characters 3-4
* Characters 5-8
Does it make sense to split this data into 3 separate columns?
Each one could be indexed, and you can rebuild the original thanks to a
generated column:
https://www.postgresql.org/docs/current/ddl-generated-columns.html
HTH, Thomas
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2023-11-04 01:59:38 | Re: Local postgres manual |
Previous Message | Tom Lane | 2023-11-03 20:01:30 | Re: Indexing fragments of a column's value ? |