Indexing fragments of a column's value ? - Mailing list pgsql-general

From David Gauthier
Subject Indexing fragments of a column's value ?
Date
Msg-id CAEs=6Dm_UsHekAcUUGSLVwAtb+zvfLL+0DVTyB+VyuVFvhPjcQ@mail.gmail.com
Whole thread Raw
Responses Re: Indexing fragments of a column's value ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Indexing fragments of a column's value ?  (Kirk Wolak <wolakk@gmail.com>)
List 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 !

pgsql-general by date:

Previous
From: Ben Hancock
Date:
Subject: Re: Local postgres manual
Next
From: Tom Lane
Date:
Subject: Re: Local postgres manual