| From: | Moreno Andreo <moreno(dot)andreo(at)evolu-s(dot)it> |
|---|---|
| To: | pgsql-general(at)lists(dot)postgresql(dot)org |
| Subject: | Functions and Indexes |
| Date: | 2024-11-18 14:37:57 |
| Message-ID: | 8dfd0bd5-87e5-4de7-9f60-8a680a32bc11@evolu-s.it |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hi folks,
I'm creating indexes for some tables, and I came across a doubt.
If a column appears in the WHERE clause (and so it should be placed in
index), in case it is "processed" in a function (see below), is it
possible to insert this function to further narrow down things?
Common index:
SELECT foo1, foo2 FROM bar WHERE foo1 = 2
CREATE index bar1_idx ON bar USING btree(foo1);
What about if query becomes
SELECT foo1, foo2 FROM bar WHERE (POSITION(foo1 IN 'blah blah') >0)
Second question: I 've seen contrasting opinions about putting JOIN
parameters (ON a.field1 = b.field2) in an index and I'd like to know
your thoughts.
Thanks,
Moreno.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Gianni Ceccarelli | 2024-11-18 14:43:07 | Re: Functions and Indexes |
| Previous Message | Julien Rouhaud | 2024-11-18 09:36:13 | Re: Re : Credcheck extension |