I use the unusual bytea column type in a PostgreSQL DB because the data in this column is like a blob. I mostly contains text, but sometimes it contains binary data.
Which index would fit if the query like this gets done?
WHERE (UPPER("my_bytea_col"::text) LIKE '%FOO%'
LIKE 'FOO'
- which would be identical to= 'FOO'
. But in generalcreate index on the_table ( (UPPER("my_bytea_col"::text) text_pattern_ops)
would be usable by LIKE. But you can't index column values that are bigger than approximately 2K - if yourbytea
column is bigger than that, you won't be able to insert rows containing data exceeding that limit