PostgreSQL daterange not using index correctly
I have a simple table which has a user_birthday field with a type of date (which can be NULL value) CREATE TABLE users ( user_id bigserial NOT NULL, user_email text NOT NULL, user_password text, user_first_name text NOT NULL, user_middle_name text, user_last_name text NOT NULL, user_birthday date, CONSTRAINT pk_users PRIMARY KEY (user_id) ) There's an index (btree) defined on that field, with the rule of NOT user_birthday IS NULL. CREATE INDEX ix_users_birthday ON users USING btree (user_birthday) WHERE NOT user_birthday IS NULL; Trying to follow up on another idea, I've added the extension