Re: Unique indexes not unique?

From: Jimmy Mäkelä <jimmy(dot)makela(at)agent25(dot)se>
To: 'Tomasz Myrta' <jasiek(at)klaster(dot)net>
Cc: "'pgsql-sql(at)postgresql(dot)org'" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Unique indexes not unique?
Date: 2003-01-13 10:56:09
Message-ID: D1045567F50DD311AB1B00508B3188E9026546D9@RINGHALS
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

From: Tomasz Myrta [mailto:jasiek(at)klaster(dot)net]
> I'm not sure unique index works properly for null values. I can't
> explain, why. Maybe it comes from SQL standard - null i a
> special value

Yeah, I thought about that too, but I think that behaviour is really bad and
would consider it a bug. There are good reasons for having a special SQL null,
but
none of these apply to unique indexes (not that I can think of anyway).

> Try to rewrite your query to show postgres how to use index on AB:
> SELECT * FROM "table"
> WHERE
> (a = 1 AND b > 1232132 AND b < 123123123213123) or
> (a = 2 AND b > 1232132 AND b < 123123123213123) or
> (a = 3 AND b > 1232132 AND b < 123123123213123);

Sure, this works, and is an improvement to the UNION-version, but I think
postgres should be able do these substitutions by itself in the
planner/optimizer...

Or is there any method for specifying optimizer hints?

Regards,
Jimmy

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2003-01-13 12:08:04 Re: Unique indexes not unique?
Previous Message Tomasz Myrta 2003-01-13 10:43:36 Re: Unique indexes not unique?