Skip site navigation (1) Skip section navigation (2)

Re: Large # of rows in query extremely slow, not using

From: Pierre-Frédéric Caillaud <lists(at)boutiquenumerique(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Large # of rows in query extremely slow, not using
Date: 2004-09-14 19:27:55
Message-ID: opseb0ctjmcq72hf@musicbox (view raw, whole thread or download thread mbox)
Thread:
Lists: pgsql-performance
>> 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.

In response to

Responses

pgsql-performance by date

Next:From: Simon RiggsDate: 2004-09-14 20:38:49
Subject: Re: Data Warehouse Reevaluation - MySQL vs Postgres --
Previous:From: Vivek KheraDate: 2004-09-14 18:27:46
Subject: Re: Data Warehouse Reevaluation - MySQL vs Postgres -- merge tables

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group