Re: Anything I can do to speed up this query? - Mailing list pgsql-general

From Ron Johnson
Subject Re: Anything I can do to speed up this query?
Date
Msg-id 4575ED3D.7060402@cox.net
Whole thread Raw
In response to Anything I can do to speed up this query?  (Wei Weng <wweng@kencast.com>)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 12/05/06 14:56, Wei Weng wrote:
> I have a table that has roughly 200,000 entries and many columns.
>
> The query is very simple:
>
> SELECT Field1, Field2, Field3... FieldN FROM TargetTable;
>
> TargetTable has an index that is Field1.
>
> The thing is on this machine with 1Gig Ram, the above query still takes
> about 20 seconds to finish. And I need it to run faster, ideally around
> 5 seconds.
>
> I already increased the following configurations:
>
[snip]
> And the EXPLAIN ANALYZE result is also as follows:
>
>                                                                 QUERY
> PLAN
> -----------------------------------------------------------------------
>  Seq Scan on TargetTable  (cost=0.00..28471.72 rows=210872 width=988)
> (actual time=0.037..6084.385 rows=211286 loops=1)
>  Total runtime: 6520.499 ms
>
> what else can I improve? Thanks in advance

Are you dumping this to the screen or {file|application}?  Video is
slow, so that would take time.

Also, MVCC seems to fragment data in "very multi-user" situations.
Maybe the data is not localized on disk?

As for the Seq Scan, Alexander is correct.  What is the point of
using an index if there are no aggregates or WHERE, ORDER BY, GROUP
BY, etc clauses?

- --
Ron Johnson, Jr.
Jefferson LA  USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFde09S9HxQb37XmcRAtTtAJ0Szm1TNRrtQooByAlwQA+5LIKxwwCgsZL1
x+qg5JXCgTbkwju/8WxIQ4o=
=npoa
-----END PGP SIGNATURE-----

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: PG Admin
Next
From: Ragnar
Date:
Subject: Re: [ANNOUNCE] PostgreSQL 8.2 Now Available