X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5913C329D20 for ; Fri, 10 Sep 2004 03:53:31 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 84266-06 for ; Fri, 10 Sep 2004 02:53:23 +0000 (GMT) Received: from angel.lonelyplanet.com.au (mail.lonelyplanet.com.au [202.147.44.168]) by svr1.postgresql.org (Postfix) with ESMTP id 5BCD3329E3B for ; Fri, 10 Sep 2004 03:53:25 +0100 (BST) Received: from shiva.au.lpint.net ([192.168.61.22]) by angel with InterScan Messaging Security Suite; Fri, 10 Sep 2004 12:50:30 +1000 Received: by shiva.au.lpint.net with Internet Mail Service (5.5.2656.59) id ; Fri, 10 Sep 2004 12:50:35 +1000 Message-ID: <82E30406384FFB44AFD1012BAB230B55037D0591@shiva.au.lpint.net> From: Theo Galanakis To: 'Josh Berkus' Cc: pgsql-sql@postgresql.org Subject: Re: Isnumeric function? Date: Fri, 10 Sep 2004 12:50:27 +1000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2656.59) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C496E0.EDB48D10" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.0 tagged_above=0.0 required=5.0 tests=DNS_FROM_RFCI_DSN, EXCUSE_16, HTML_20_30, HTML_MESSAGE X-Spam-Level: ** X-Archive-Number: 200409/69 X-Sequence-Number: 18915 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C496E0.EDB48D10 Content-Type: text/plain Josh, I agree with the machete technique, unfortunately The structure is inplace and a work-around was required. I created the Index you specified, however it chooses to run a seq scan on the column rather than a Index scan. How can you force it to use that Index.. CREATE INDEX idx_content_numeric ON botched_table(content) WHERE content ~ '^[0-9]{1,9}$'; select * from botched_table where content = 200::integer Theo -----Original Message----- From: Josh Berkus [mailto:josh@agliodbs.com] Sent: Friday, 10 September 2004 4:46 AM To: Theo Galanakis; pgsql-sql@postgresql.org Subject: Re: [SQL] Isnumeric function? Theo, > Does anyone have any better suggestions??? Well, one suggestion would be to take a machete to your application. Putting key references and text data in the same column? Sheesh. If that's not an option, in addition to the approach you've taken, you could also do a partial index on the appropriate numeric values: CREATE INDEX idx_content_numeric ON botched_table(content) WHERE content ~ '^[0-9]{1,9}$'; However, this approach may be more/less effective that the segregation approach you've already taken. -- Josh Berkus Aglio Database Solutions San Francisco ______________________________________________________________________ This email, including attachments, is intended only for the addressee and may be confidential, privileged and subject to copyright. If you have received this email in error, please advise the sender and delete it. If you are not the intended recipient of this email, you must not use, copy or disclose its content to anyone. You must not copy or communicate to others content that is confidential or subject to copyright, unless you have the consent of the content owner. ------_=_NextPart_001_01C496E0.EDB48D10 Content-Type: text/html Content-Transfer-Encoding: quoted-printable RE: [SQL] Isnumeric function?

Josh,

I agree with the machete technique, unfortunately The str= ucture is inplace and a work-around was required.

I created the Index you specified, however it chooses to = run a seq scan on the column rather than a Index scan. How can you force it= to use that Index..

CREATE INDEX idx_content_numeric ON botched_table(content= ) WHERE content ~ '^[0-9]{1,9}$';

select * from botched_table where content =3D 200::intege= r

Theo
-----Original Message-----
From: Josh Berkus [= mailto:josh@agliodbs.com]
Sent: Friday, 10 September 2004 4:46 AM
To: Theo Galanakis; pgsql-sql@postgresql.org
Subject: Re: [SQL] Isnumeric function?


Theo,

> Does anyone have any better suggestions???

Well, one suggestion would be to take a machete to your a= pplication.  Putting
key references and text data in the same column? &n= bsp; Sheesh.

If that's not an option, in addition to the approach you'= ve taken, you could
also do a partial index on the appropriate numeric value= s:

CREATE INDEX idx_content_numeric ON botched_table(content= ) WHERE content ~ '^[0-9]{1,9}$';

However, this approach may be more/less effective that th= e segregation
approach you've already taken.

--
Josh Berkus
Aglio Database Solutions
San Francisco

____________________= __________________________________________________
This email, including= attachments, is intended only for the addressee
and may be confidential= , privileged and subject to copyright. If you
have received this email = in error, please advise the sender and delete
it. If you are not the in= tended recipient of this email, you must not
use, copy or disclose its c= ontent to anyone. You must not copy or
communicate to others content t= hat is confidential or subject to
copyright, unless you have the consen= t of the content owner.
------_=_NextPart_001_01C496E0.EDB48D10--