pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jimmy Mäkelä <jimmy.makela@agent25.se>
To: Tomasz Myrta <jasiek@klaster.net>
Cc: 'pgsql-sql@postgresql.org' <pgsql-sql@postgresql.org>
Subject: Re: Unique indexes not unique?
Date: Mon, 13 Jan 2003 11:56:09 +0100
Message-ID: <D1045567F50DD311AB1B00508B3188E9026546D9@RINGHALS> (raw)

From: Tomasz Myrta [mailto:jasiek@klaster.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



view thread (9+ messages)  latest in thread

Message-ID: <D1045567F50DD311AB1B00508B3188E9026546D9@RINGHALS>
Permalink:  ../D1045567F50DD311AB1B00508B3188E9026546D9@RINGHALS/
Also on:    postgresql.org/message-id/D1045567F50DD311AB1B00508B3188E9026546D9@RINGHALS

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jimmy.makela@agent25.se, jasiek@klaster.net
  Subject: Re: Unique indexes not unique?
  In-Reply-To: <D1045567F50DD311AB1B00508B3188E9026546D9@RINGHALS>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox