From: Joshua D. Drake <jd@commandprompt.com>
To: Stephen Crowley <stephen.crowley@gmail.com>
Cc: pgsql-performance@postgresql.org, Pierre-Frédéric Caillaud <lists@boutiquenumerique.com>
Subject: Re: Large # of rows in query extremely slow, not using
Date: Thu, 16 Sep 2004 20:14:16 -0700
Message-ID: <414A5688.1030701@commandprompt.com> (raw)
In-Reply-To: <3f71fdf1040916185113e277e6@mail.gmail.com>
References: <3f71fdf104091317515c756512@mail.gmail.com>
<20040914184358.08e271fe@kingfisher.intern.logi-track.com>
<opseb0ctjmcq72hf@musicbox>
<3f71fdf1040916185113e277e6@mail.gmail.com>
> When I set enable_seqscan to OFF and force everything to use the index
> every stock I query returns within 100ms, but turn seqscan back ON and
> its back up to taking several minutes for non-index using plans.
>
> Any ideas?
> --Stephen
Try increasing your statistics target and re-running analyze. Try say 100?
Sincerely,
Joshua D. Drake
>
>
> On Tue, 14 Sep 2004 21:27:55 +0200, Pierre-Frédéric Caillaud
> <lists@boutiquenumerique.com> wrote:
>
>>>>I have a table with ~8 million rows and I am executing a query which
>>>>should return about ~800,000 rows. The problem is that as soon as I
>>>>execute the query it absolutely kills my machine and begins swapping
>>>>for 5 or 6 minutes before it begins returning results. Is postgres
>>>>trying to load the whole query into memory before returning anything?
>>>>Also, why would it choose not to use the index? It is properly
>>>>estimating the # of rows returned. If I set enable_seqscan to off it
>>>>is just as slow.
>>
>> 1; EXPLAIN ANALYZE.
>>
>> Note the time it takes. It should not swap, just read data from the disk
>>(and not kill the machine).
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match
--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com
Mammoth PostgreSQL Replicator. Integrated Replication for PostgreSQL
Attachments:jd.vcf (text/x-vcard, 638B) download
begin:vcard
fn:Joshua D. Drake
n:Drake;Joshua D.
org:Command Prompt, Inc.
adr:;;PO Box 215;Cascade Locks;Oregon;97014;USA
email;internet:jd@commandprompt.com
title:Consultant
tel;work:503-667-4564
tel;fax:503-210-0334
note:Command Prompt, Inc. is the largest and oldest US based commercial PostgreSQL support provider. We provide the only commercially viable integrated PostgreSQL replication solution, but also custom programming, and support. We authored the book Practical PostgreSQL, the procedural language plPHP, and adding trigger capability to plPerl.
x-mozilla-html:FALSE
url:http://www.commandprompt.com/
version:2.1
end:vcard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: jd@commandprompt.com, stephen.crowley@gmail.com, lists@boutiquenumerique.com
Subject: Re: Large # of rows in query extremely slow, not using
In-Reply-To: <414A5688.1030701@commandprompt.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox