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