Back to Home

My PostgreSQL performance tests

Table of Contents

  1. Introduction
  2. Hardware
  3. The FreeBSD setup
  4. The Linux setup
  5. The Test Details of the test itself
  6. Test Results The raw data
  7. Conclusions What I thought about it
  8. Feedback How to get ahold of me
  9. Revisions How this document has changed over time
  10. Attachments Misc details about the running of the tests and the setups

Introduction

Curious about many things, I embarked recently on a mission to determine a number of things about running a PostgreSQL database on a freenix operating system.

Anyone who's been following these tests since the beginning knows that I was primarily interested on finding out how FreeBSD and UFS compared to Linux and the various filesystems available. Since the initial tests, my interest has increased, and I'm planning to test a number of additional situations.

READ THIS BEFORE SENDING TEST SUGGESTIONS I'm trying to gather as much useful information as possible to help myself understand the best ways to set up a PostgreSQL server. I hope this information is useful to others (both PostgreSQL and OS developers, as well as implementers). I only have so many hours in a day. If you think my tests are biased, unrealistic or just plain bad, you're welcome to do your own tests and post them. If you think I should test a bunch of things I didn't test, let me know and I'll add them to my list, although I won't guarantee when (or even if) I'll get to them.

Take a look at the scripts and understand that the overall thing I'm looking for is Posgres use of the filesystem. To wit, this isn't so much a Linux vs. FreeBSD test, as it is a UFS vs. ext2 (and others).

The scripts were created specifically to generate lots of disk activity. Ideally, they'll saturate the disks during the run.

Keep in mind that the purpose of these tests is to try to establish which platform and what configuration will produce the fastest PostgreSQL database. I hope I'm doing the tests carefully enough that other useful information can be taken from the results as well, but we'll see. Don't try to take these results to mean that filesystem x is better/worse than filesystem y. These test are not nearly extensive enough to be used for basic "best" or "better" labels.

I'm not even shooting for "best for Postgres" as the tests only guage speed. As most people know, there are other factors of a filesystem that are important as well.

Harware

The computer is a machine that I pieced together out of parts here and there. dmesg output from FreeBSD and Linux will provide you with any details you find Interesting.

These tests are inherently broken, since Linux doesn't do UFS, and BSD doesn't do the myriad journaling filesysems available, it's impossible to get an accurate read because the other differences between Linux and FreeBSD are almost certainly skewing the results somewhat.

The best effort I made to stop this was to do a test with dd from /dev/zero to a raw partition to establish that at least the ATA drivers were roughly equivalent on both systems. I hope they're close enough, but the dd tests show that something is definately different between FreeBSD and Linux, as the sweet spot is different. Note that in each configuration, the partitions were located in the same location on the drive, to remove that wildcard.

FreeBSD setup

FreeBSD 4.8-RELEASE installed from CD (no custom kernel).

Three partitions:

  1. 3.9G /
  2. 500M swap
  3. 1900M /usr/local/pgsql/data (PostgreSQL data files)

PostgreSQL version 7.2.4 installed from precompiled FreeBSD package (straight off the FTP site).

/etc/rc.conf was edited to reduce the number of running daemons to as few as possible.

dd results

blocksize count time
8192 50000 19.55
16384 25000 19.13
32768 12500 19.09
65536 6250 19.04
131072 3125 19.06

Linux Setup

Shrike installed with minimal packages.
  • 3.9G /
  • 500M swap
  • 1900m /mnt/db (for PosgreSQL data files)

    sigh I thought I had gone through and timmed out the rc.d directories on the Linux install to remove most of the running daemons, but apparently (if you look at the ps output) I forgot this time around. The results will just have to stand until I get time to redo them.

    dd results

    blocksize count time
    4096 100000 20.446
    8192 50000 20.265
    16384 25000 20.316
    32768 12500 20.429
    65536 6250 20.858

    The test

    I formulated my own set of test scripts for this experiment. This script is used to populate a table:

    CREATE TABLE test1 (
        thedate TIMESTAMP,
        astring VARCHAR(200),
        anumber INTEGER
    );
    
    CREATE FUNCTION build_data() RETURNS integer AS '
        DECLARE
            i INTEGER DEFAULT 0;
            curtime TIMESTAMP;
        BEGIN
            FOR i IN 1..1000000 LOOP
                curtime := ''now'';
                INSERT INTO test1 VALUES (curtime, ''test string'', i);
            END LOOP;
            RETURN 1;
        END;
    ' LANGUAGE 'plpgsql';
    
    SELECT build_data();
    

    Then the following script is run under the time program to ascertain how long it takes to run:

    CREATE TABLE test2  (
        thedate TIMESTAMP,
        astring VARCHAR(200),
        anumber INTEGER
    );
    CREATE TABLE test3 AS SELECT * FROM test1;
    INSERT INTO test2 SELECT * FROM test1 WHERE ((anumber % 2) = 0);
    DELETE FROM test3 WHERE ((anumber % 2) = 0);
    DELETE FROM test3 WHERE ((anumber % 13) = 0);
    CREATE TABLE test4 AS
     SELECT test1.thedate AS t1date,
            test2.thedate AS t2date,
            test1.astring AS t1string,
            test2.astring AS t2string,
            test1.anumber AS t1number,
            test2.anumber AS t2number
     FROM test1 JOIN test2 ON test1.anumber=test2.anumber;
    UPDATE test3 SET thedate='now' WHERE ((anumber % 5) = 0);
    DROP TABLE test4;
    CREATE TABLE test4 AS SELECT * FROM test1;
    DELETE FROM test4 WHERE ((anumber % 27) = 0);
    VACUUM ANALYZE;
    VACUUM FULL;
    DROP TABLE test4;
    DROP TABLE test3;
    DROP TABLE test2;
    VACUUM FULL;
    

    In each case, the partition holding the PostgreSQL data files was formatted and mounted a specific way and then initialized for databases. The setup script was run to create 2 million test records, then the test script was run multiple times under the time command to ascertain how long it took. In between runs, steps were taken to ensure all disk data was flushed (usually the issuing of sync until disk activity stopped)

    In many cases, I threw out the result of the first test, as it was often considerably higher than the other two, and running the test a fourth time seemed to indicate that the first run was not a good guage of the filesystem's capabilities. I guess it takes some activity before some freshly mounted filesystems "ramp up" to full performance.

    Results

    The table is organized with fastest performers at the top.

    Rank OS PostgreSQL filesystem mount Times Average time Relative speed Speed Index Relative Speed Index
    #1 RedHat shrike (Linux 2.4.20) 7.3.2 (from RPM) JFS default 251.55s
    236.035s
    242.695s
    243.43s 1.28 .083 1.28
    #2 RedHat shrike (Linux 2.4.20) 7.3.2 (from RPM) ext2 default 251.9s
    246.71s
    246.479s
    248.36s 1.25 .082 1.26
    #3 RedHat shrike (Linux 2.4.20) 7.3.2 (from RPM) Reiser 3 default 254.185s
    249.142s
    250.009s
    251.11s 1.24 .081 1.25
    #4 RedHat shrike (Linux 2.4.20) 7.3.2 (from RPM) ext2 noatime 255.532s
    259.911s
    256.873s
    257.44s 1.21 .081 1.25
    #5 FreeBSD 4.8-RELEASE 7.3.2 (from package) UFS1 async 265.48s
    265.55s
    264.47s
    265.17s 1.17 .074 1.14
    #6 FreeBSD 4.8-RELEASE 7.3.2 (from package) UFS1 softupdates + noatime 272.18s
    270.88s
    272.33s
    271.80s 1.14 .072 1.11
    #7 FreeBSD 4.8-RELEASE 7.3.2 (from package) UFS1 softupdates 270.43s
    275.24s
    270.97s
    272.21s 1.14 .071 1.09
    #8 RedHat shrike (Linux 2.4.20) 7.3.2 (from RPM) ext3 default 313.475s
    309.220s
    310.239s
    310.98s 1 .065 1

    Table explanation

    Most of the table is self explanatary, however there are some columns that utilize Bill's Twisted Mathematical Relationships(tm) and thus require some explanation. (No, the average time isn't one of them!)

    Conclusions

    While a lot more testing should be done before any solid conclusions are drawn, some things stand out.

    If you abosolutely must have speed, jfs on Linux appears to be the way to go.

    I read somewhere that FAT was actually the fastest filesystem for running PostgreSQL databases on. However, I encountered difficulty getting initdb to create a cluster on a FAT filesystem (since it doesn't support symlinks) so the test did not get run.

    Hopefully I'll get time to run more tests in the near future. In particular, I'd like to devise some sort of multi-threaded test, to see if the results change when multiple threads are accessing the database at once. I'm also trying to work out a strategy to determine a performance index so anyone can run the test and submit their results. Obviously, simply using time will skew the results, since better hardware will produce better times. I'm also hoping to have time to try optimizing both the FreeBSD systems, as well as the Linux systems to see just how much performance can be gained by doing things such as recompiling PostgreSQL with processor optimizations.

    Obviously, these tests aren't perfect, and it's highly unlikely that they represent true database usage under any production load. However, I believe the results would be useful both to decision makers installing PostgreSQL, as well as to developers who want to make their systems work as best as can be.

    Don't ask me why noatime is slower on ext2 than without it, I'm stumped on that point as well. I actually ran the noatime test 5 times because I threw out the first two when they seemed unreasonably high. Go figure.

    Some people have asked why certain tests were done and certain others weren't. The easy answer is "because I said so". Simply put, I'm taking time out of my day to run the tests, so I'm testing what I think will be interesting. That doesn't mean that I won't run tests suggested by others. It just means that you've got to convince me that the results will be interesting.

    Feedback

    Please don't contact me about these tests unless you've taken enough time to read this entire document. I spent a considerabl amount of my time running these tests and putting together this document. If you don't at least do me the favor of reading the whole thing before you contact me, you'll just tick me off.

    Got something intelligent to say about these tests? My name is Bill Moran, and you can click here to contact me.

    Revisions

    Attachments

    Here are many details relevent to the tests.

    FreeBSD dmesg

    Copyright (c) 1992-2003 The FreeBSD Project.
    Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
    	The Regents of the University of California. All rights reserved.
    FreeBSD 4.8-RELEASE #0: Thu Apr  3 10:53:38 GMT 2003
        root@freebsd-stable.sentex.ca:/usr/obj/usr/src/sys/GENERIC
    Timecounter "i8254"  frequency 1193182 Hz
    CPU: AMD Athlon(tm) processor (950.04-MHz 686-class CPU)
      Origin = "AuthenticAMD"  Id = 0x642  Stepping = 2
      Features=0x183f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR>
      AMD Features=0xc0440000<RSVD,AMIE,DSP,3DNow!>
    real memory  = 268435456 (262144K bytes)
    avail memory = 255963136 (249964K bytes)
    Preloaded elf kernel "kernel" at 0xc051d000.
    Pentium Pro MTRR support enabled
    md0: Malloc disk
    Using $PIR table, 7 entries at 0xc00fdd30
    npx0: <math processor> on motherboard
    npx0: INT 16 interface
    pcib0: <Host to PCI bridge> on motherboard
    pci0: <PCI bus> on pcib0
    agp0: <VIA 82C8363 (Apollo KT133A) host to PCI bridge> mem 0xe0000000-0xe3ffffff at device 0.0 on pci0
    pcib1: <VIA 8363 (Apollo KT133) PCI-PCI (AGP) bridge> at device 1.0 on pci0
    pci1: <PCI bus> on pcib1
    pci1: <3Dfx model 0009 graphics accelerator> at 0.0 irq 10
    isab0: <VIA 82C686 PCI-ISA bridge> at device 7.0 on pci0
    isa0: <ISA bus> on isab0
    atapci0: <VIA 82C686 ATA100 controller> port 0xd000-0xd00f at device 7.1 on pci0
    atapci0: Correcting VIA config for southbridge data corruption bug
    ata0: at 0x1f0 irq 14 on atapci0
    ata1: at 0x170 irq 15 on atapci0
    uhci0: <VIA 83C572 USB controller> port 0xd400-0xd41f irq 5 at device 7.2 on pci0
    usb0: <VIA 83C572 USB controller> on uhci0
    usb0: USB revision 1.0
    uhub0: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
    uhub0: 2 ports with 2 removable, self powered
    uhci1: <VIA 83C572 USB controller> port 0xd800-0xd81f irq 5 at device 7.3 on pci0
    usb1: <VIA 83C572 USB controller> on uhci1
    usb1: USB revision 1.0
    uhub1: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
    uhub1: 2 ports with 2 removable, self powered
    pci0: <unknown card> (vendor=0x1106, dev=0x3057) at 7.4
    rl0: <RealTek 8139 10/100BaseTX> port 0xe800-0xe8ff mem 0xe5000000-0xe50000ff irq 11 at device 11.0 on pci0
    rl0: Ethernet address: 00:50:bf:74:75:b8
    miibus0: <MII bus> on rl0
    rlphy0: <RealTek internal media interface> on miibus0
    rlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
    orm0: <Option ROM> at iomem 0xc0000-0xc7fff on isa0
    fdc0: <NEC 72065B or clone> at port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on isa0
    atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 on isa0
    atkbd0: <AT Keyboard> flags 0x1 irq 1 on atkbdc0
    kbd0 at atkbd0
    psm0: <PS/2 Mouse> irq 12 on atkbdc0
    psm0: model IntelliMouse, device ID 3
    vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
    sc0: <System console> at flags 0x100 on isa0
    sc0: VGA <16 virtual consoles, flags=0x300>
    sio0 at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0
    sio0: type 16550A
    sio1 at port 0x2f8-0x2ff irq 3 on isa0
    sio1: type 16550A
    ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0
    ppc0: Generic chipset (EPP/NIBBLE) in COMPATIBLE mode
    plip0: <PLIP network interface> on ppbus0
    lpt0: <Printer> on ppbus0
    lpt0: Interrupt-driven port
    ppi0: <Parallel I/O> on ppbus0
    ad0: 7190MB <MDT MD75AA-00BAA0> [14610/16/63] at ata0-master UDMA66
    acd0: CDROM <CRD-8320B> at ata1-slave PIO4
    Mounting root from ufs:/dev/ad0s1a
    

    Linux dmesg

    Linux version 2.4.20-8 (bhcompile@stripples.devel.redhat.com) (gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #1 Thu Mar 13 17:18:24 EST 2003
    BIOS-provided physical RAM map:
     BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
     BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
     BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
     BIOS-e820: 0000000000100000 - 0000000010000000 (usable)
     BIOS-e820: 00000000ffff0000 - 0000000100000000 (reserved)
    0MB HIGHMEM available.
    256MB LOWMEM available.
    On node 0 totalpages: 65536
    zone(0): 4096 pages.
    zone(1): 61440 pages.
    zone(2): 0 pages.
    Kernel command line: ro root=LABEL=/
    Initializing CPU#0
    Detected 950.053 MHz processor.
    Console: colour VGA+ 80x25
    Calibrating delay loop... 1893.99 BogoMIPS
    Memory: 253048k/262144k available (1312k kernel code, 6660k reserved, 996k data, 128k init, 0k highmem)
    Dentry cache hash table entries: 32768 (order: 6, 262144 bytes)
    Inode cache hash table entries: 16384 (order: 5, 131072 bytes)
    Mount cache hash table entries: 512 (order: 0, 4096 bytes)
    Buffer-cache hash table entries: 16384 (order: 4, 65536 bytes)
    Page-cache hash table entries: 65536 (order: 6, 262144 bytes)
    CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
    CPU: L2 Cache: 256K (64 bytes/line)
    Intel machine check architecture supported.
    Intel machine check reporting enabled on CPU#0.
    CPU:     After generic, caps: 0183f9ff c1c7f9ff 00000000 00000000
    CPU:             Common caps: 0183f9ff c1c7f9ff 00000000 00000000
    CPU: AMD Athlon(tm) processor stepping 02
    Enabling fast FPU save and restore... done.
    Checking 'hlt' instruction... OK.
    POSIX conformance testing by UNIFIX
    mtrr: v1.40 (20010327) Richard Gooch (rgooch@atnf.csiro.au)
    mtrr: detected mtrr type: Intel
    PCI: PCI BIOS revision 2.10 entry at 0xfb3b0, last bus=1
    PCI: Using configuration type 1
    PCI: Probing PCI hardware
    Disabling VIA memory write queue (PCI ID 0305, rev 02): [55] 89 & 1f -> 09
    PCI: Using IRQ router VIA [1106/0686] at 00:07.0
    Applying VIA southbridge workaround.
    isapnp: Scanning for PnP cards...
    isapnp: No Plug & Play device found
    Linux NET4.0 for Linux 2.4
    Based upon Swansea University Computer Society NET3.039
    Initializing RT netlink socket
    apm: BIOS version 1.2 Flags 0x07 (Driver version 1.16)
    Starting kswapd
    VFS: Disk quotas vdquot_6.5.1
    pty: 2048 Unix98 ptys configured
    Serial driver version 5.05c (2001-07-08) with MANY_PORTS MULTIPORT SHARE_IRQ SERIAL_PCI ISAPNP enabled
    ttyS0 at 0x03f8 (irq = 4) is a 16550A
    ttyS1 at 0x02f8 (irq = 3) is a 16550A
    Real Time Clock Driver v1.10e
    FDC 0 is a post-1991 82077
    NET4: Frame Diverter 0.46
    RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
    Uniform Multi-Platform E-IDE driver Revision: 7.00beta-2.4
    ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
    VP_IDE: IDE controller at PCI slot 00:07.1
    VP_IDE: chipset revision 6
    VP_IDE: not 100% native mode: will probe irqs later
    ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
    VP_IDE: VIA vt82c686b (rev 40) IDE UDMA100 controller on pci00:07.1
        ide0: BM-DMA at 0xd000-0xd007, BIOS settings: hda:DMA, hdb:pio
        ide1: BM-DMA at 0xd008-0xd00f, BIOS settings: hdc:pio, hdd:DMA
    hda: MDT MD75AA-00BAA0, ATA DISK drive
    blk: queue c03be900, I/O limit 4095Mb (mask 0xffffffff)
    hdd: CRD-8320B, ATAPI CD/DVD-ROM drive
    ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
    ide1 at 0x170-0x177,0x376 on irq 15
    hda: host protected area => 1
    hda: 14726880 sectors (7540 MB) w/2048KiB Cache, CHS=916/255/63, UDMA(66)
    ide-floppy driver 0.99.newide
    Partition check:
     hda: hda1 hda2 hda3
    ide-floppy driver 0.99.newide
    md: md driver 0.90.0 MAX_MD_DEVS=256, MD_SB_DISKS=27
    md: Autodetecting RAID arrays.
    md: autorun ...
    md: ... autorun DONE.
    NET4: Linux TCP/IP 1.0 for NET4.0
    IP Protocols: ICMP, UDP, TCP, IGMP
    IP: routing cache hash table of 2048 buckets, 16Kbytes
    TCP: Hash tables configured (established 16384 bind 32768)
    Linux IP multicast router 0.06 plus PIM-SM
    NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
    RAMDISK: Compressed image found at block 0
    Freeing initrd memory: 144k freed
    VFS: Mounted root (ext2 filesystem).
    Journalled Block Device driver loaded
    kjournald starting.  Commit interval 5 seconds
    EXT3-fs: mounted filesystem with ordered data mode.
    Freeing unused kernel memory: 128k freed
    usb.c: registered new driver usbdevfs
    usb.c: registered new driver hub
    usb-uhci.c: $Revision: 1.275 $ time 17:26:20 Mar 13 2003
    usb-uhci.c: High bandwidth mode enabled
    PCI: Found IRQ 5 for device 00:07.2
    PCI: Sharing IRQ 5 with 00:07.3
    usb-uhci.c: USB UHCI at I/O 0xd400, IRQ 5
    usb-uhci.c: Detected 2 ports
    usb.c: new USB bus registered, assigned bus number 1
    hub.c: USB hub found
    hub.c: 2 ports detected
    PCI: Found IRQ 5 for device 00:07.3
    PCI: Sharing IRQ 5 with 00:07.2
    usb-uhci.c: USB UHCI at I/O 0xd800, IRQ 5
    usb-uhci.c: Detected 2 ports
    usb.c: new USB bus registered, assigned bus number 2
    hub.c: USB hub found
    hub.c: 2 ports detected
    usb-uhci.c: v1.275:USB Universal Host Controller Interface driver
    usb.c: registered new driver hiddev
    usb.c: registered new driver hid
    hid-core.c: v1.8.1 Andreas Gal, Vojtech Pavlik 
    hid-core.c: USB HID support drivers
    mice: PS/2 mouse device common for all mice
    EXT3 FS 2.4-0.9.19, 19 August 2002 on ide0(3,1), internal journal
    Unable to find swap-space signature
    kjournald starting.  Commit interval 5 seconds
    EXT3 FS 2.4-0.9.19, 19 August 2002 on ide0(3,2), internal journal
    EXT3-fs: mounted filesystem with ordered data mode.
    Unable to find swap-space signature
    parport0: PC-style at 0x378 [PCSPP,EPP]
    parport_pc: Via 686A parallel port: io=0x378
    ip_tables: (C) 2000-2002 Netfilter core team
    8139too Fast Ethernet driver 0.9.26
    PCI: Found IRQ 11 for device 00:0b.0
    divert: allocating divert_blk for eth0
    eth0: RealTek RTL8139 Fast Ethernet at 0xd0861000, 00:50:bf:74:75:b8, IRQ 11
    eth0:  Identified 8139 chip type 'RTL-8139C'
    ip_tables: (C) 2000-2002 Netfilter core team
    eth0: Setting 100mbps full-duplex based on auto-negotiated partner ability 45e1.
    
    

    ps output from FreeBSD machine

      PID  TT  STAT      TIME COMMAND
        0  ??  DLs    0:00.00  (swapper)
        1  ??  ILs    0:00.00 /sbin/init --
        2  ??  DL     0:00.00  (pagedaemon)
        3  ??  DL     0:00.00  (vmdaemon)
        4  ??  DL     0:00.04  (bufdaemon)
        5  ??  DL     0:00.01  (vnlru)
        6  ??  DL     0:00.09  (syncer)
       60  ??  Is     0:00.00 /sbin/dhclient rl0
       78  ??  Ss     0:00.02 /usr/sbin/syslogd -s
       85  ??  Is     0:00.01 /usr/sbin/cron
      296  v0- I      0:00.03 /usr/local/bin/postmaster (postgres)
      297  v0- I      0:00.00 postmaster: stats buffer process    (postgres)
      299  v0- I      0:00.00 postmaster: stats collector process    (postgres)
      356  v0  Ss     0:00.02 -csh (csh)
      361  v0  R+     0:00.00 ps -ax
      355  v1  Is+    0:00.00 /usr/libexec/getty Pc ttyv1
      102  v2  Is+    0:00.00 /usr/libexec/getty Pc ttyv2
    

    ps output from Linux machine

      PID TTY      STAT   TIME COMMAND
        1 ?        S      0:04 init
        2 ?        SW     0:00 [keventd]
        3 ?        SW     0:00 [kapmd]
        4 ?        SWN    0:00 [ksoftirqd_CPU0]
        9 ?        SW     0:00 [bdflush]
        5 ?        DW     0:00 [kswapd]
        6 ?        SW     0:00 [kscand/DMA]
        7 ?        SW     0:00 [kscand/Normal]
        8 ?        SW     0:00 [kscand/HighMem]
       10 ?        DW     0:00 [kupdated]
       11 ?        SW     0:00 [mdrecoveryd]
       15 ?        SW     0:00 [kjournald]
       73 ?        SW     0:00 [khubd]
     1956 ?        SW     0:00 [eth0]
     2005 ?        S      0:00 /sbin/dhclient -1 -q -lf /var/lib/dhcp/dhclient-eth0.
     2056 ?        S      0:00 syslogd -m 0
     2060 ?        S      0:00 klogd -x
     2078 ?        S      0:00 [portmap]
     2097 ?        S      0:00 [rpc.statd]
     2164 ?        S      0:00 /usr/sbin/apmd -p 10 -w 5 -W -P /etc/sysconfig/apm-sc
     2201 ?        S      0:00 /usr/sbin/sshd
     2225 ?        S      0:00 [sendmail]
     2234 ?        S      0:00 [sendmail]
     2244 ?        S      0:00 gpm -t imps2 -m /dev/mouse
     2253 ?        S      0:00 crond
     2262 ?        SN     0:00 anacron -s
     2271 ?        S      0:00 [atd]
     2279 ?        S      0:00 login -- root     
     2281 tty3     S      0:00 /sbin/mingetty tty3
     2282 tty4     S      0:00 /sbin/mingetty tty4
     2283 tty5     S      0:00 /sbin/mingetty tty5
     2284 tty6     S      0:00 /sbin/mingetty tty6
     2285 tty1     S      0:00 -bash
     2344 ?        SW     0:00 [jfsIO]
     2345 ?        SW     0:00 [jfsCommit]
     2346 ?        SW     0:00 [jfsSync]
     2591 tty1     S      0:00 [su]
     2592 tty1     S      0:00 bash
     2862 tty1     S      0:00 /usr/bin/postmaster
     2863 tty1     S      0:00 postgres: stats buffer process   
     2864 tty1     S      0:00 postgres: stats collector process   
     2950 ?        S      0:00 login -- root     
     2955 tty1     S      0:00 /usr/bin/time psql -f test.sql test
     2956 tty1     S      0:00 psql -f test.sql test
     2957 tty1     D      0:11 postgres: postgres test [local] SELECT
     2959 tty2     S      0:00 -bash
     3006 tty2     S      0:00 [su]
     3007 tty2     S      0:00 bash
     3009 tty2     R      0:00 ps -ax
    

    top snapshot on FreeBSD

    last pid:   860;  load averages:  0.07,  0.08,  0.12  up 0+03:15:18    14:04:22
    13 processes:  2 running, 11 sleeping
    
    Mem: 8776K Active, 131M Inact, 42M Wired, 35M Buf, 66M Free
    Swap: 500M Total, 8K Used, 500M Free
    
    
      PID USERNAME PRI NICE  SIZE    RES STATE    TIME   WCPU    CPU COMMAND
      856 pgsql     31   0  8012K  3936K RUN      0:08 34.38% 22.95% postgres
      356 root      18   0  1336K   844K pause    0:00  0.00%  0.00% csh
      860 root      29   0  1896K   884K RUN      0:00  0.00%  0.00% top
       78 root       2   0   948K   564K select   0:00  0.00%  0.00% syslogd
       85 root      10   0  1024K   612K nanslp   0:00  0.00%  0.00% cron
      355 root      18   0  1324K   828K pause    0:00  0.00%  0.00% csh
      850 pgsql      2   0  7136K  2500K select   0:00  0.00%  0.00% postgres
      855 root       2   0  2996K  1284K select   0:00  0.00%  0.00% psql
      102 root       3   0   952K   520K ttyin    0:00  0.00%  0.00% getty
      852 pgsql      2   0  7164K  2504K select   0:00  0.00%  0.00% postgres
      854 root      10   0   868K   360K wait     0:00  0.00%  0.00% time
      851 pgsql      2   0  8124K  2476K select   0:00  0.00%  0.00% postgres
       60 root       2   0   932K   468K select   0:00  0.00%  0.00% dhclient
    

    top snapshot on Linux

    49 processes: 47 sleeping, 2 running, 0 zombie, 0 stopped
    CPU states:  36.0% user  11.0% system   0.0% nice   0.0% iowait  53.0% idle
    Mem:   255372k av,  252036k used,    3336k free,       0k shrd,    5304k buff
                         34748k actv,  101988k in_d,    3596k in_c
    Swap:       0k av,       0k used,       0k free                  227576k cached
    
      PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
     2957 postgres  16   0  3564 3564  2780 D    44.7  1.3   0:15   0 postmaster
        5 root      15   0     0    0     0 RW    0.3  0.0   0:00   0 kswapd
       10 root      15   0     0    0     0 SW    0.1  0.0   0:00   0 kupdated
        1 root      15   0   472  472   420 S     0.0  0.1   0:04   0 init
        2 root      15   0     0    0     0 SW    0.0  0.0   0:00   0 keventd
        3 root      15   0     0    0     0 SW    0.0  0.0   0:00   0 kapmd
        4 root      34  19     0    0     0 SWN   0.0  0.0   0:00   0 ksoftirqd_CPU
        9 root      15   0     0    0     0 SW    0.0  0.0   0:00   0 bdflush
        6 root      15   0     0    0     0 SW    0.0  0.0   0:00   0 kscand/DMA
        7 root      15   0     0    0     0 SW    0.0  0.0   0:00   0 kscand/Normal
        8 root      15   0     0    0     0 SW    0.0  0.0   0:00   0 kscand/HighMe
       11 root      25   0     0    0     0 SW    0.0  0.0   0:00   0 mdrecoveryd
       15 root      15   0     0    0     0 SW    0.0  0.0   0:00   0 kjournald
       73 root      25   0     0    0     0 SW    0.0  0.0   0:00   0 khubd
     1956 root      15   0     0    0     0 SW    0.0  0.0   0:00   0 eth0
     2005 root      24   0   952  952   688 S     0.0  0.3   0:00   0 dhclient
     2056 root      15   0   548  548   468 S     0.0  0.2   0:00   0 syslogd
    

    iostat snapshot on FreeBSD

          tty             ad0             acd0              md0             cpu
     tin tout  KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s  us ni sy in id
       0   40 16.00 619  9.67   0.00   0  0.00   0.00   0  0.00   8  0  2  0 90