With the following 3 indexes, the "AND" query will use the index with multiple rows, whilst the "OR" query will use the combination of single indexes.
CREATE INDEX user_email_id_index
ON action_audits
USING btree
(user_email COLLATE pg_catalog."default", user_id);
CREATE INDEX user_email_index
ON action_audits
USING btree
(user_email COLLATE pg_catalog."default");
CREATE INDEX user_index
ON action_audits
USING btree
(user_id);
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.