From: | "Marc Morin" <marc(at)sandvine(dot)com> |
---|---|
To: | "Andrus" <eetasoft(at)online(dot)ee>, <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: Query runs too long for indexed tables |
Date: | 2006-04-04 20:03:30 |
Message-ID: | 2BCEB9A37A4D354AA276774EE13FB8C2BCC556@mailserver.sandvine.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Explain analyze would be nice ;-)
> -----Original Message-----
> From: pgsql-performance-owner(at)postgresql(dot)org
> [mailto:pgsql-performance-owner(at)postgresql(dot)org] On Behalf Of Andrus
> Sent: Tuesday, April 04, 2006 3:37 PM
> To: pgsql-performance(at)postgresql(dot)org
> Subject: [PERFORM] Query runs too long for indexed tables
>
> I have relatively small tables (toode and rid) in fast server.
> Both tables are indexed on toode field.
>
> Following query takes long time to run.
> toode field type is char(20). It is difficult to change this
> field type.
>
> Any idea how to speed up this query ?
>
> UPDATE firma1.rid SET toode=NULL
> WHERE toode IS NOT NULL AND
> toode NOT IN (SELECT TOODE FROM firma1.TOODE);
>
> Query returned successfully: 0 rows affected, 594813 ms
> execution time.
>
> explain window shows:
>
> Seq Scan on rid (cost=2581.07..20862553.77 rows=51848 width=1207)
> Filter: ((toode IS NOT NULL) AND (NOT (subplan)))
> SubPlan
> -> Materialize (cost=2581.07..2944.41 rows=14734 width=84)
> -> Seq Scan on toode (cost=0.00..2350.34
> rows=14734 width=84)
>
>
> Andrus.
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Nasby | 2006-04-04 20:26:37 | Re: Query using SeqScan instead of IndexScan |
Previous Message | Marc Morin | 2006-04-04 20:00:13 | Re: Query runs too long for indexed tables |