Re: Case Insensitive

From: "Brad Nicholson" <bradn(at)ca(dot)ibm(dot)com>
To: Andreas Kretschmer <andreas(at)a-kretschmer(dot)de>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org, Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>
Subject: Re: Case Insensitive
Date: 2019-03-28 12:38:50
Message-ID: OF53D60194.8AA2C9B8-ON852583CB.00454D5D-852583CB.0045793C@notes.na.collabserv.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-general


Andreas Kretschmer <andreas(at)a-kretschmer(dot)de> wrote on 03/28/2019 07:28:53
AM:

> >
> > Ummm... Will it use an index (a BTree index)?
> >
>
> test=# explain select * from emp where ename = 'aaa';
>                      QUERY PLAN
> -----------------------------------------------------
>  Seq Scan on emp  (cost=0.00..25.88 rows=6 width=36)
>    Filter: (ename = 'aaa'::citext)
> (2 rows)
>
> test=*# set enable_seqscan to off;
> SET
> test=*# explain select * from emp where ename = 'aaa';
>                                QUERY PLAN
> ------------------------------------------------------------------------
>  Seq Scan on emp  (cost=10000000000.00..10000000025.88 rows=6 width=36)
>    Filter: (ename = 'aaa'::citext)
> (2 rows)
>
> test=*# create index emp_ename on emp(ename);
> CREATE INDEX
> test=*# explain select * from emp where ename = 'aaa';
>                               QUERY PLAN
> ----------------------------------------------------------------------
>  Index Scan using emp_ename on emp  (cost=0.13..8.14 rows=1 width=36)
>    Index Cond: (ename = 'aaa'::citext)
> (2 rows)

I used citext heavily in a past project and was quite happy with it. It
was never a source of performance issues.

Brad.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Mark Steben 2019-03-28 12:39:29 Re: Long running query in new production, not so long in old
Previous Message Tim Clarke 2019-03-28 12:09:25 Re: Case Insensitive

Browse pgsql-general by date

  From Date Subject
Next Message Michael Paquier 2019-03-28 13:30:05 Re: stale WAL files?
Previous Message Tim Clarke 2019-03-28 12:09:25 Re: Case Insensitive