Re: mnogosearch -- pgsql seem so slow, please help me find out why

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Thomas T(dot) Thai" <tom(at)minnesota(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: mnogosearch -- pgsql seem so slow, please help me find out why
Date: 2001-01-12 17:27:36
Message-ID: 16543.979320456@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Thomas T. Thai" <tom(at)minnesota(dot)com> writes:
> On Fri, 12 Jan 2001, Tom Lane wrote:
>> "Thomas T. Thai" <tom(at)minnesota(dot)com> writes:
>>>> 'select * from url' from psql monitor took 59 seconds.
>>
>> How big is the table? Your EXPLAIN mentions 99256 rows, but I can't
>> tell if that stat is up-to-date or not.

> it is 99256. i don't think it's that big of a table is it? typically the
> query under mnogo takes less than a second, at most a couple seconds but
> not 50+ secs.

Typical queries don't retrieve the whole of a large table. SQL speed
is all about *not* doing that. Do the math: while I don't know the
average width of your rows, it looked like 500 bytes would be in the
right ballpark. So you're moving circa 50 megabytes of data in this
query, or a tad under a meg/second, which is not blazing but it's pretty
respectable when you consider the number of layers of software involved.
(What exactly were you doing with the data after it got to psql, BTW?
In my experience psql can chew up near as much CPU time as the backend
for this sort of bulk data display.) To do this in under a second would
require total throughput exceeding 50 meg/second, which is probably a
good bit more than the sustained read speed your filesystem can achieve,
never mind any time for Postgres' and psql's processing.

If you want a fast search, you should be designing a WHERE clause that
exploits an index so that you *don't* read the entire darn table.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Dan Moschuk 2001-01-12 17:34:57 Re: exit status 26
Previous Message Thomas T. Thai 2001-01-12 16:58:27 Re: mnogosearch -- pgsql seem so slow, please help me find out why