From: | David Gauthier <dfgpostgres(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Indexing fragments of a column's value ? |
Date: | 2023-11-03 19:33:51 |
Message-ID: | CAEs=6Dm_UsHekAcUUGSLVwAtb+zvfLL+0DVTyB+VyuVFvhPjcQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I'm asking about the possibility of indexing portions of a column's value
where the column has a static field format. Example, a char(8) which
contains all hex values (basically a hex number that's always 8 chars wide,
leading zeros if needed). Someone might want to select all recs where the
first 2 digits are 'ff' or maybe the last 4 hex digits match regexp_match
'00[cdef]{2}' or maybe a match of the entire string... "0dd63a87".
If I know the placement and width of the fields that need to be indexed,
can indices be defined to facilitate queries ? Example...
- match all 8 chars
- match the 3rd and 4th chars
- match the last 4 chars
I suppose I could fragment the thing into multiple columns for the purposes
of a search. So add a column called "last4" as a char(4) that matches the
last 4 chars of that column. Then index that. etc... But inquiring to see
if there is something more elegant.
Thanks !
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2023-11-03 19:58:05 | Re: Local postgres manual |
Previous Message | Ben Hancock | 2023-11-03 19:16:35 | Re: Local postgres manual |