optimizing impossible matches

From: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: optimizing impossible matches
Date: 2004-03-10 14:45:49
Message-ID: 6EE64EF3AB31D5448D0007DD34EEB34101AD84@Herge.rcsinc.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear hackers:
Is it reasonable or possible to have the optimizer filter out impossible
string/numeric matches because of length/overflow conditions?

For example: (on 7.4.1)

select * from t where f = '1234567' -- f = char(6)
explain says index/seq scan, depending on presence of index, when
obviously there can be no matches.

also, for the typical case for indexed field f,
select * from t where f = f' or false
generates an index scan

but
select * from t where f = f' or f = f''
generates a seq. scan with default settings. If f'' is not in the
domain of f, the first case should apply. Is this really as simple as
it seems?

Merlin

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Merlin Moncure 2004-03-10 15:00:55 Re: Timing of 'SELECT 1'
Previous Message Matthew Kirkwood 2004-03-10 13:10:12 Re: Scalable postgresql using sys_epoll