On Wed, Jun 21, 2006 at 03:47:19PM +0200, nicky wrote:
> WHERE substr(t0.code,1,2) not in ('14','15','16','17')
> AND (substr(t0.correctie,4,1) <> '1' OR t0.correctie is null)
> AND EXTRACT(YEAR from t1.datum) > 2004;
How much data do you expect to be getting back from that where clause?
Unless you plan on inserting most of the table, some well-placed indexes
would probably help, and fixing the datum portion might as well
(depending on how far back the data goes). Specifically:
CREATE INDEX t0_code_partial ON t0(substr(code,1,2));
(yeah, I know t0 is an alias, but I already snipped the table name)
AND t1.datum >= '1/1/2005'
(might need to cast that to a date or whatever).
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461
In response to
pgsql-performance by date
|Next:||From: Jim C. Nasby||Date: 2006-06-21 18:57:53|
|Subject: Re: Help tuning autovacuum - seeing lots of relation bloat|
|Previous:||From: Jim C. Nasby||Date: 2006-06-21 18:33:05|
|Subject: Re: Big array speed issues|