Re: datatype advice numeric vs. varchar

From: "shakahshakah(at)gmail(dot)com" <shakahshakah(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: datatype advice numeric vs. varchar
Date: 2007-01-18 13:28:07
Message-ID: 1169126887.565168.257320@v45g2000cwv.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Jan 18, 1:25 am, genekh(dot)(dot)(dot)(at)gmail(dot)com (Gene) wrote:
> you're probably right, actually using LIKE with numeric works fine but
> of course i will have to contend with things like truncating zeros to
> the left etc... are there any advantages to using ascii encoding as
> far as performance of LIKE, REGEXES, INDEXES etc versus using UTF8?
>
> thanks, gene

You might want to check out the following link, particularly if your
database is UTF-8, use varchar for your TNs, and you want to look for
calls from certain NPA/NXX/block_id ranges, e.g. with "WHERE ani LIKE
'2015551%'. As I understand it, an index created with a simple "CREATE
INDEX blah ON tbl (ani)" won't get used in that situation, whereas one
created with "CREATE INDEX blah2 ON tbl (ani varchar_pattern_ops)"
will.

http://www.postgresql.org/docs/8.2/interactive/indexes-opclass.html

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ole Laurisch 2007-01-18 13:40:27 Defining data directory while installing [WinXP]
Previous Message Ron Johnson 2007-01-18 13:14:23 Re: datatype advice numeric vs. varchar