X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 146EA9FA147 for ; Sun, 9 Jul 2006 21:52:52 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 54983-06 for ; Sun, 9 Jul 2006 21:52:44 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.178]) by postgresql.org (Postfix) with ESMTP id 3C0BC9FB1E7 for ; Sun, 9 Jul 2006 21:52:43 -0300 (ADT) Received: by py-out-1112.google.com with SMTP id d80so3690546pyd for ; Sun, 09 Jul 2006 17:52:42 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=EO1fvzsOuhx4joOeQZhpPB/vnSYHYTqAW2s+MVLpGb4ny3oDsWnh1sSqdTeVcTmqP7/cMoXhCbMcCgumpzih/AFV7K9IQxkur5446y96kdmOmuLPMHobcDaPTwxlx5e1ez2KpotYdWXiJEv2ss6z8qU+qlm1fQL2WFQ5+TI5oAU= Received: by 10.35.82.15 with SMTP id j15mr4523408pyl; Sun, 09 Jul 2006 17:52:42 -0700 (PDT) Received: by 10.35.40.18 with HTTP; Sun, 9 Jul 2006 17:52:42 -0700 (PDT) Message-ID: <5a6f767a0607091752y5018f9eaw474dc5cf7de3c4c3@mail.gmail.com> Date: Mon, 10 Jul 2006 10:52:42 +1000 From: "Neil Hepworth" To: pgsql-performance@postgresql.org Subject: High CPU Usage - PostgreSQL 7.3 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200607/85 X-Sequence-Number: 19945 Hi, I am running PostgreSQL 7.3 on a Linux box (RHEL 2.1 - Xeon 2.8GHz with 1GB of RAM) and seeing very high CPU usage (normally over 90%) when I am running the following queries, and the queries take a long time to return; over an hour! CREATE TEMPORARY TABLE fttemp1600384653 AS SELECT * FROM ftoneway LIMIT 0; INSERT INTO fttemp1600384653 SELECT epId, TO_TIMESTAMP(start, 'YYYY-MM-DD HH24:00:00.0')::timestamp AS start, 60 AS consolidation, SUM(cnt) AS cnt FROM ftone WHERE consolidation = 0 AND start < TO_TIMESTAMP('2006-06-27 18:43:27.391103+1000', 'YYYY-MM-DD HH24:00:00.0')::timestamp; DELETE FROM ONLY ftone WHERE ftoneway.epId= fttemp1600384653.epId; The only changes I've made to the default postgresql.comf file are listed below: LC_MESSAGES = 'en_US' LC_MONETARY = 'en_US' LC_NUMERIC = 'en_US' LC_TIME = 'en_US' tcpip_socket = true max_connections = 20 effective_cache_size = 32768 wal_buffers = 128 fsync = false shared_buffers = 3000 max_fsm_relations = 10000 max_fsm_pages = 100000 The tables are around a million rows but when when I run against tables of a few hundred thousand rows it still takes tens of minutes with high CPU. My database does have a lot of tables (can be several thousand), can that cause performance issues? Thanks, Neil