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

query slows down drastically with increased number of fields

From: "Tom Darci" <tom(at)nuws(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: query slows down drastically with increased number of fields
Date: 2006-10-25 17:20:42
Message-ID: 6FB011BE26AACD4CB5F2B505AE0BEB2E020B6E86@MI8NYCMAIL05.Mi8.com (view raw or flat)
Thread:
Lists: pgsql-performance
Hello All-
 
  We have a question about numbers of fields in the select clause of a
query and how that affects query speed.
  The following query simply selects the primary key field from a table
with 100,000 records:
 
------------------------------------------------------------
select p.opid
FROM 
ott_op p

------------------------------------------------------------
 
  It runs in about half a second (running in PgAdmin... the query run
time, not the data retrieval time)
 
  When we change it by adding fields to the select list, it slows down
drastically. This version takes about 3 seconds:
 
------------------------------------------------------------
select p.opid, p.opid, p.opid, p.opid, p.opid, p.opid, p.opid, p.opid,
p.opid, p.opid, p.opid
FROM 
ott_op p

------------------------------------------------------------
 
  The more fields we add, the slower it gets.
 
  My guess is that we are missing a configuration setting... any ideas?
  Any help much appreciated.
 
Thanks,
-Tom

Responses

pgsql-performance by date

Next:From: Craig A. JamesDate: 2006-10-25 17:28:05
Subject: Re: Best COPY Performance
Previous:From: Spiegelberg, GregDate: 2006-10-25 17:15:40
Subject: Re: Best COPY Performance

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