Re: CIText and pattern_ops

From: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
To: Rod Taylor <pg(at)rbt(dot)ca>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: CIText and pattern_ops
Date: 2010-04-26 09:53:28
Message-ID: 20100426185328.927E.52131E4D@oss.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Rod Taylor <pg(at)rbt(dot)ca> wrote:

> Is there any particular reason why the citext module doesn't have
> citext_pattern_ops operator family?
>
> Specifically, I wish to index for this type of query:
>
> ... WHERE citext_column LIKE 'Foo%';

I think it is a reasonable suggestion.

=# \d tbl
Table "public.tbl"
Column | Type | Modifiers
--------+--------+-----------
t | text |
c | citext |
Indexes:
"tbl_c_idx" btree (c)
"tbl_t_idx" btree (t)

=# SET enable_seqscan = off;
SET
=# EXPLAIN SELECT * FROM tbl WHERE t LIKE 'abc%';
QUERY PLAN
----------------------------------------------------------------------
Index Scan using tbl_t_idx on tbl (cost=0.00..8.27 rows=1 width=64)
Index Cond: ((t >= 'abc'::text) AND (t < 'abd'::text))
Filter: (t ~~ 'abc%'::text)
(3 rows)

=# EXPLAIN SELECT * FROM tbl WHERE c LIKE 'abc%';
QUERY PLAN
------------------------------------------------------------------------
Seq Scan on tbl (cost=10000000000.00..10000000001.01 rows=1 width=64)
Filter: (c ~~ 'abc%'::citext)
(2 rows)

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2010-04-26 10:08:49 Re: recovery_connections cannot start
Previous Message Dimitri Fontaine 2010-04-26 08:41:30 Re: recovery_connections cannot start