| From: | Gregory Stark <stark(at)enterprisedb(dot)com> |
|---|---|
| To: | Bill Moran <wmoran(at)potentialtech(dot)com> |
| Cc: | "Philippe Lang" <philippe(dot)lang(at)attiksystem(dot)ch>, <pgsql-general(at)postgresql(dot)org> |
| Subject: | Re: Query 4-5 times slower after ANALYZE |
| Date: | 2009-03-18 12:53:06 |
| Message-ID: | 878wn3f0wd.fsf@oxford.xeocode.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Bill Moran <wmoran(at)potentialtech(dot)com> writes:
> I opened one of those links figuring I'd take a few minutes to see if I could
> muster up some advice ... and just started laughing ... definitely not the
> type of query that one can even understand in just a few minutes!
You might consider setting default_statistics_target to 100 and re-analyzing.
The estimates don't look too far off but like Bill I haven't analyzed it very
carefully.
One other things that stands out, using comparisons like
('now'::date - creation_date) >= <expression>
is going to make it hard to optimize. Better to use something like
creation_date <= now() - <expression>
Both because of the now() instead of 'now'::date and because the latter is a
comparison that can be indexed instead of an expression which could use an
index on creation_date.
--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com
Ask me about EnterpriseDB's On-Demand Production Tuning
| From | Date | Subject | |
|---|---|---|---|
| Next Message | paulo matadr | 2009-03-18 13:20:52 | Report all Comments |
| Previous Message | tv | 2009-03-18 12:51:04 | Re: Query 4-5 times slower after ANALYZE |