Re: [HACKERS] Sequential scan speed, mmap, disk i/o]

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: dg(at)illustra(dot)com (David Gould)
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [HACKERS] Sequential scan speed, mmap, disk i/o]
Date: 1998-05-29 17:28:23
Message-ID: 199805291728.NAA28567@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> > > Very interesting. Is it possible to get the schema, the query, and a
> > > a sample of the data or a generator program for the data? I am quite surprised
> > > to see us do so well, I would have guess that the per row overhead would
> > > have us down far below wc.
> >
> > Sure.
> >
> > create table test (x1 int, x2 int, x3 char(10), x4 varchar(50));
> > insert into test values (3, 8, 'asdf','asdf');
> >
> > insert into test select * from test; <- continue until test is large
> >
> > select * from test where x1 = 23423; <- this is what I timed
> >
>
> So I finally got around to playing with this a little and I get on my
>
> P133 (HX mb) 32 Mb mem, Linux 2.0.32 (glibc) with Quantum Atlas 2.1G disk
> on NCR810 SCSI

OK, I have a Barracuda drive, which is probably the same speed as the
Atlas(Ultra SCSI), but have a PP200, which may be why my PostgreSQL
could keep up better with the disks.

My dd's showed ~6,000 KB/sec, postgresql was 4,800 KB/sec, and wc was
4,500 KB/sec. Interesting how the speed fell off with the count().
That is executor overhead, I am sure.

>
> for test at 1048576 rows, file size is 80281600 bytes.
>
> - time cat pg/test/data/base/dg/test >/dev/null
> 0.02user 3.38system 0:14.34elapsed 23%CPU = 5467 KB per second.
>
> - time wc pg/test/data/base/dg/test
> 9.12user 2.83system 0:15.38elapsed 77%CPU = 5098 KB per second.
>
> - time psql -c "select * from test where x1 = 23423;"
> 0:30.59elapsed (cpu for psql not meaningful, but top said 95% for postgres)
> = 2563 KB per second.
> Not bad!
>
> - time psql -c "select count(*) from test;"
> 0:50.46elapsed = 1554 KB per second.
> (trivial aggragate adds 20 seconds or 65%)
>
> - time psql -c "select count(*) from test where x1 = 3;"
> 1:03.22elapsed = 1240 KB per second.
> (trivial where clause adds another 13 seconds)
>
> - time psql -c "select count(*) from test where x4 = 'asdf';"
> 1:10.96elapsed = 1105 KB per second.
> (varchar compare vs int compare adds only 7.7 seconds).
>
>
> Btw, during all this, the disk hardly even made any noise (seeking).
> ext2 seems to lay things out pretty well. The data dir right now is on a
> /home, which is 86% full and it still managed to stream the 'cat' at about
> full disk bandwidth.

--
Bruce Momjian | 830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Web Events 1998-05-29 18:17:35 Rod Stewart Live Online
Previous Message Bruce Momjian 1998-05-29 17:15:29 Removal of exec() patch applied