From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Gokulakannan Somasundaram <gokul007(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Clarification reqeusted for "select * from a huge table" |
Date: | 2007-11-12 11:55:54 |
Message-ID: | 47383F4A.9060701@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Gokulakannan Somasundaram wrote:
> Hi,
> I had a chance to test one of the real world cases with Oracle and
> PostgreSQL. Create a Table with 10 million rows (i worked on a 1GB RAM
> machine) both in oracle and Postgresql. Just write a JDBC program for
> a 'select *' on that table. With PostgreSQL as backend, java crashes
> saying that it has met 'Out Of Memory'. With Oracle it doesn't.
> Postgres tried to send all the results back to the client at one
> shot, whereas in Oracle it works like a Cursor. Is this issue already
> well known among hackers community? If known, why is it designed this
> way?
It returns everything because you've asked for it. If you wanted
something that looks like a cursor, PG assumes you'll request a cursor.
As to why, there are two reasons:
1. It's always been that way and changing it now would irritate most of
the existing user-base.
2. Repeat your test with 5,10,50,100 clients all running different big
queries and see which puts a greater load on the server. PG favours
supporting lots of clients by pushing the load onto them.
> I also noticed that it doesn't crash with psql, but it takes a
> long time to show the first set of records. It takes a long time, even
> to quit after i pressed 'q'.
> With oracle SQLPlus, it is quite instantaneous.
Again, you're measuring different things. What is the time to the *last*
row?
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Trevor Talbot | 2007-11-12 12:00:04 | Re: 8.2.3: Server crashes on Windows using Eclipse/Junit |
Previous Message | Markus Schiltknecht | 2007-11-12 10:57:04 | Re: High Availability, Load Balancing, and Replication Feature Matrix |