pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Hans-Jürgen Schönig <hs@cybertec.at>
To: pgsql-sql@postgresql.org
Subject: Regular expressions and indexes
Date: Fri, 27 Apr 2001 11:04:25 +0200
Message-ID: <3AE93619.BE51C143@cybertec.at> (raw)
Is there any possibility to make PostgreSQL use indexes when working
with regular expressions?
performance=# EXPLAIN SELECT * FROM perftest WHERE id=100;
NOTICE: QUERY PLAN:
Index Scan using idx_id_perftest on perftest (cost=0.00..4.98 rows=1
width=20)
EXPLAIN
performance=# EXPLAIN SELECT * FROM perftest WHERE id ~ '^100$';
NOTICE: QUERY PLAN:
Seq Scan on perftest (cost=100000000.00..100218966.00 rows=100000
width=20)
EXPLAIN
It is clear that complex regular expressions can possibly never use an
index but is it possible to use it when looking for the beginning of a
string (e.g.: ^100).
Hans
view thread (2+ messages) latest in thread
Message-ID: <3AE93619.BE51C143@cybertec.at> Permalink: ../3AE93619.BE51C143@cybertec.at/ Also on: postgresql.org/message-id/3AE93619.BE51C143@cybertec.at ·
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 from your mail client; the link fills in the headers below: reply via email Some clients, webmail especially, drop In-Reply-To and References from a link, and the reply then starts a new thread: use the mbox below. To: pgsql-sql@postgresql.org Cc: hs@cybertec.at Subject: Re: Regular expressions and indexes In-Reply-To: <3AE93619.BE51C143@cybertec.at> References: <3AE93619.BE51C143@cybertec.at> * 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