pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pierre-Frédéric Caillaud <lists@boutiquenumerique.com>
To: pgsql-performance@postgresql.org
Subject: Re: Large # of rows in query extremely slow, not using
Date: Tue, 14 Sep 2004 21:27:55 +0200
Message-ID: <opseb0ctjmcq72hf@musicbox> (raw)
In-Reply-To: <20040914184358.08e271fe@kingfisher.intern.logi-track.com>
References: <3f71fdf104091317515c756512@mail.gmail.com>
	<20040914184358.08e271fe@kingfisher.intern.logi-track.com>


>> 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).

	2; Run the query in your software

	Note the time it takes. Watch RAM usage. If it's vastly longer and you're  
swimming in virtual memory, postgres is not the culprit... rather use a  
cursor to fetch a huge resultset bit by bit.

	Tell us what you find ?

	Regards.



view thread (17+ messages)  latest in thread

Message-ID: <opseb0ctjmcq72hf@musicbox>
Permalink:  ../opseb0ctjmcq72hf@musicbox/
Also on:    postgresql.org/message-id/opseb0ctjmcq72hf@musicbox

 · 

reply

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: lists@boutiquenumerique.com
  Subject: Re: Large # of rows in query extremely slow, not using
  In-Reply-To: <opseb0ctjmcq72hf@musicbox>

* 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