Scalar in a range (but textual not numeric) - Mailing list pgsql-sql

From Richard Huxton
Subject Scalar in a range (but textual not numeric)
Date
Msg-id 200402251918.20289.dev@archonet.com
Whole thread Raw
Responses Re: Scalar in a range (but textual not numeric)
Re: Scalar in a range (but textual not numeric)
Re: Scalar in a range (but textual not numeric)
List pgsql-sql
Large table representing non-overlapping blocks:

blocks(id int4, min varchar, max varchar)

SELECT * FROM blocks WHERE 'ABCDE' BETWEEN min AND max;

The estimator gets the wrong plan because it doesn't realise there's (at most) 
only one block that can match.

Can't use any of the geometry related types since we've got text here not 
numbers. Nothing in the archives seems quite right (AFAICT).

Any smart ideas? I'm happy to trade time when updating the blocks table 
against lookup speed.

--  Richard Huxton Archonet Ltd


pgsql-sql by date:

Previous
From: Robert Treat
Date:
Subject: Re: [PERFORM] [HACKERS] Materialized View Summary
Next
From: Richard Huxton
Date:
Subject: Re: Scalar in a range (but textual not numeric)