Unix Technical Forum

SELECT statement takes 10 minutes to answer

This is a discussion on SELECT statement takes 10 minutes to answer within the Pgsql General forums, part of the PostgreSQL category; --> Hi, Iam using PostgreSQL 7.4.5 on a linux machine, and have the problem that an easy "SELECT field1, field2, ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 11:16 AM
Mustafa Korkmaz
 
Posts: n/a
Default SELECT statement takes 10 minutes to answer

Hi,

Iam using PostgreSQL 7.4.5 on a linux machine, and have the problem
that an easy "SELECT field1, field2, field3 FROM a_table"-statement
takes 10 minutes to give an answer. The table has 750.000 datarows. I
also made an VACUUM a_table before the statement, but it doesnt help at
all. The table has an index to a timestamp field..
What could be the problem, or is it normal that postgresql cant handle
with so many data in an acceptable response-time?

Regards,
M.Korkmaz

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 11:16 AM
Chris Browne
 
Posts: n/a
Default Re: SELECT statement takes 10 minutes to answer

"Mustafa Korkmaz" <Musti.de@gmx.de> writes:
> Iam using PostgreSQL 7.4.5 on a linux machine, and have the problem
> that an easy "SELECT field1, field2, field3 FROM a_table"-statement
> takes 10 minutes to give an answer. The table has 750.000 datarows. I
> also made an VACUUM a_table before the statement, but it doesnt help at
> all. The table has an index to a timestamp field..
> What could be the problem, or is it normal that postgresql cant handle
> with so many data in an acceptable response-time?


Well, an index is certainly not going to help if you don't have any
selection criteria that would diminish the quantity of data involved.

Ten minutes for 750K rows seems a long time.

Mind you, if this is all taking place on a single host, and you
haven't much memory, then it would make sense that:
a) Collecting the rows in the backend session might start swapping,
and then
b) Collecting the rows in the return set on the client side would
place that same amount of data in RAM again, further worsening
swapping.

You might run "top" while processing this; if it's chewing into swap
space while data is transferred to the client, then the above scenario
might be descriptive of why you're seeing terrible performance.

The answer to this sort of problem tends to be to use a cursor, and
have the client fetch smaller numbers of rows at a time.
--
(format nil "~S@~S" "cbbrowne" "ntlug.org")
http://www.ntlug.org/~cbbrowne/
"We believe Windows 95 is a walking antitrust violation"
-- Bryan Sparks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-09-2008, 11:19 AM
A. Kretschmer
 
Posts: n/a
Default Re: SELECT statement takes 10 minutes to answer

am 19.06.2006, um 5:26:54 -0700 mailte Mustafa Korkmaz folgendes:
> Hi,
>
> Iam using PostgreSQL 7.4.5 on a linux machine, and have the problem
> that an easy "SELECT field1, field2, field3 FROM a_table"-statement


Hey, read my answer on your question in the news, MID
<1150720704.328939.25700@f6g2000cwb.googlegroups.c om> ;-)


Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47215, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:08 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com