Earlier quoted context omitted.
Postgres can do indexes on expressions. (A bitmap scan over 2 rows may not be the most impressive example!) https://www.postgresql.org/docs/12/indexes-expressional.html foo=# create table foo(x TEXT); foo=# CREATE INDEX foo_r3 on foo (right(x,3)); foo=# INSERT INTO foo VALUES ('aaaaaaaaaaaaazzz'); foo=# INSERT INTO foo VALUES ('xxxxxxxaaa'); foo=# SELECT * FROM foo WHERE right(x,3) > 'fff'; x ------------------ aaaaa…
If one thinks about how that index is created underneath the covers, it's basically precomputing that column and using it as an index! =)
Yes exactly. But it works very well in practice.