Re: []performance issues

From: "Sergio A(dot) Kessler" <sak(at)ksb(dot)com(dot)ar>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: []performance issues
Date: 2002-08-02 13:38:03
Message-ID: aie1hv$1csc$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers


times change if you do
"SELECT COUNT(1) FROM stats" ?

--
:: Sergio A. Kessler ::
Linux user #64005 - http://counter.li.org

"Yaroslav Dmitriev" <yar(at)warlock(dot)ru> escribi en el mensaje
news:3D4A49E7(dot)6090405(at)warlock(dot)ru(dot)(dot)(dot)
> Hello,
>
> Sorry if it's wrong list for the question. Could you suggest some tweaks
> to the PostgreSQL 7.2.1 to handle the following types of tables faster?
>
> Here we have table "stats" with something over one millon records.
> Obvious "SELECT COUNT(*) FROM stats " takes over 40 seconds to execute,
> and this amount of time does not shorten considerably in subsequent
> similar requests. All the databases are vacuumed nightly.
>
> CREATE TABLE "stats" (
> "url" varchar(50),
> "src_port" varchar(10),
> "ip" varchar(16),
> "dst_port" varchar(10),
> "proto" varchar(10),
> "size" int8,
> "login" varchar(20),
> "start_date" timestamptz,
> "end_date" timestamptz,
> "aggregated" int4
> );
> CREATE INDEX "aggregated_stats_key" ON "stats" ("aggregated");
> CREATE INDEX "ip_stats_key" ON "stats" ("ip");
>
> stats=> explain select count(*) from stats;
> NOTICE: QUERY PLAN:
>
> Aggregate (cost=113331.10..113331.10 rows=1 width=0)
> -> Seq Scan on stats (cost=0.00..110085.28 rows=1298328 width=0)
>
> EXPLAIN
> stats=> select count(*) from stats;
> count
> ---------
> 1298328
> (1 row)
>
> The system is FreeBSD-4.6-stable, softupdates on, Athlon XP 1500+, 512 Mb
DDR, ATA 100 HDD.
>
> Thanks in advance,
> Yar
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-08-02 13:39:54 Re: Questions regarding contrib/tsearch
Previous Message Arguile 2002-08-02 13:26:28 Re: Selecting random row

Browse pgsql-hackers by date

  From Date Subject
Next Message J. R. Nield 2002-08-02 13:48:40 Re: PITR, checkpoint, and local relations
Previous Message Marc G. Fournier 2002-08-02 13:36:00 Re: Does this go out?