SeaQL / sea-query

🔱 A dynamic SQL query builder for MySQL, Postgres and SQLite
https://www.sea-ql.org
Other
1.16k stars 192 forks source link

Postgres: Support creating functional indexes #756

Open gitmalong opened 7 months ago

gitmalong commented 7 months ago

Motivation

Create functional indexes

for example, a common way to do case-insensitive comparisons is to use the lower function:

SELECT * FROM test1 WHERE lower(col1) = 'value'; This query can use an index, if one has been defined on the result of the lower(column) operation:

CREATE INDEX test1_lower_col1_idx ON test1 (lower(col1));

Source: https://www.postgresql.org/docs/7.3/indexes-functional.html

Proposed Solutions

Additional Information

ap32 commented 6 months ago

Link for postgres 16: https://www.postgresql.org/docs/16/indexes-expressional.html