| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | - - <loh(dot)law(at)hotmail(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Slow query with sub-select |
| Date: | 2011-07-16 15:58:22 |
| Message-ID: | 27349.1310831902@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
- - <loh(dot)law(at)hotmail(dot)com> writes:
> The weird thing is that before I updated my server the query was about 5 times faster.
> I've googled and I think the problem lies with the under-estimation of the query planner about the number of rows in the nested table.I will be trying the 'set enable_seqscan = false' solution to see if that'll improve.
You evidently already do have that turned off. I'd suggest reverting
that change (ie, allow seqscan) and instead increase work_mem enough
so that the hash join can work without spilling to disk. This query
is a perfect example of where indexes do not help, and trying to force
them to be used makes things slower not faster.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | cesitarps | 2011-07-16 16:14:35 | pass XML as an argument and INSERT (key/value pairs) in postgresql |
| Previous Message | - - | 2011-07-16 14:42:39 | Re: Slow query with sub-select |