From: Ulrich Habel <espero7757@gmx.net>
To: pgsql-performance@postgresql.org
Subject: query planner: automatic rescribe of LIKE to BETWEEN ?
Date: Tue, 22 Aug 2006 19:22:59 +0200
Message-ID: <200608221922.59734.espero7757@gmx.net> (raw)
Hello all,
had an idea of optimizing a query that may work generally.
In case a 'column' is indexed, following two alterations could be done
I think:
A)
select ... where column ~ '^Foo' --> Seq Scan
into that:
select ... where column BETWEEN 'Foo' AND 'FooZ' --> Index Scan
of course 'Z' should be the last possible character internally used of the
DBMS.
That would work as long as there is no in-case-sensitive search being done.
another rescribtion:
B)
select ... where column ~ '^Foo$' --> Seq Scan
into that:
select ... where column = 'Foo' --> Bitmap Heap Scan
That speeds up things, too.
That would also apply to 'LIKE' and 'SIMILAR TO' operations, I think.
Is there any idea to make the "Query Planner" more intelligent to do these
convertions automatically?
Anythings speeks against this hack?
Regards
Uli Habel
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-performance@postgresql.org
Cc: espero7757@gmx.net
Subject: Re: query planner: automatic rescribe of LIKE to BETWEEN ?
In-Reply-To: <200608221922.59734.espero7757@gmx.net>
* 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