Re: optimize query?

From: hamann(dot)w(at)t-online(dot)de
To: pgsql-general(at)postgresql(dot)org
Subject: Re: optimize query?
Date: 2013-01-30 13:32:37
Message-ID: 510920F5.mailx43Y11TD0Y@amadeus3.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Janes 2013-01-30 14:47:38 Re: trouble with upgrade from 9.0 (many schemas and tables)
Previous Message c k 2013-01-30 13:19:18 Re: finding if a period is multiples of a given interval