pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: hamann.w@t-online.de
To: pgsql-general@postgresql.org
Subject: Re: optimize query?
Date: Wed, 30 Jan 2013 14:32:37 +0100
Message-ID: <510920F5.mailx43Y11TD0Y@amadeus3.local> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>


Bob Futrelle wrote:

If looking for the variants with a single suffixed character is all you'll
ever need to do:
Do a single pass on the large table, after creating a field, 'trunc' that
contains a truncated version of the item, e.g., adding XY423 to trunc for
each entry of the form XY423A, or XY423B, etc.  This would be a one-time
operation.

Hi Bob,

unfortunately it is not because  the suffix pattern is not always the same.
On the other hand, I tried to split the query into

select substring (code from '^[A-Z]+[0-9]+') as code into tmp table t
select .... where tab2.code = t.code

which definitely was a big improvement. I believe that most of the time
passing in a pattern like that would work

So thank you for that tip

Regards
Wolfgang


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



view thread (14+ messages)  latest in thread

Message-ID: <510920F5.mailx43Y11TD0Y@amadeus3.local>
Permalink:  ../510920F5.mailx43Y11TD0Y@amadeus3.local/
Also on:    postgresql.org/message-id/510920F5.mailx43Y11TD0Y@amadeus3.local

 · 

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-general@postgresql.org
  Cc: hamann.w@t-online.de
  Subject: Re: optimize query?
  In-Reply-To: <510920F5.mailx43Y11TD0Y@amadeus3.local>
  References: <510920F5.mailx43Y11TD0Y@amadeus3.local>

* 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