X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8DA7DD1E60A for ; Fri, 30 Apr 2004 06:15:37 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 06097-10 for ; Fri, 30 Apr 2004 06:15:14 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 4AAABD1CA48 for ; Fri, 30 Apr 2004 06:15:09 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i3U9F8Sx049966 for ; Fri, 30 Apr 2004 09:15:08 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i3U8jl03026033 for pgsql-sql@postgresql.org; Fri, 30 Apr 2004 08:45:47 GMT From: francescosaf X-Newsgroups: comp.databases.postgresql.sql Subject: Re: problem with slow select Date: Fri, 30 Apr 2004 04:25:28 -0500 Message-ID: Organization: Web Servers forum User-Agent: www.webservertalk.com news gateway X-Newsreader: www.webservertalk.com news gateway X-Originating-IP: 147.162.2.222 Lines: 32 X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 To: pgsql-sql@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=1.1 tagged_above=0.0 required=5.0 tests=HOT_NASTY, NO_DNS_FOR_FROM X-Spam-Level: * X-Archive-Number: 200405/21 X-Sequence-Number: 17735 thank you for answer and excuse me for later this is query plan: QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------- Nested Loop (cost=10564.42..10853.74 rows=1 width=150) (actual time=11626.89..12060.36 rows=6 loops=1) -> Merge Join (cost=10564.42..10820.69 rows=6 width=131) (actual time=11626.45..12058.84 rows=6 loops=1) Merge Cond: (("outer".idcode = "inner".idcode) AND ("outer".time = "inner".time)) -> Sort (cost=7550.07..7675.40 rows=50134 width=104) (actual time=8910.91..9031.23 rows=49293 loops=1) Sort Key: XXXX.idcode, XXXX.time -> Seq Scan on XXXX (cost=0.00..1586.34 rows=50134 width=104) (actual time=0.10..852.78 rows=50515 loops=1) -> Sort (cost=3014.35..3017.11 rows=1102 width=31) (actual time=2419.43..2419.45 rows=6 loops=1) Sort Key: temptable.idcode, temptable.time -> Subquery Scan temptable (cost=2876.08..2958.70 rows=1102 width=31) (actual time=2154.84..2419.15 rows=6 loops=1) -> Aggregate (cost=2876.08..2958.70 rows=1102 width=31) (actual time=2154.83..2419.10 rows=6 loops=1) -> Group (cost=2876.08..2931.16 rows=11016 width=31) (actual time=2066.58..2389.91 rows=19486 loops=1) -> Sort (cost=2876.08..2903.62 rows=11016 width=31) (actual time=2066.55..2106.39 rows=19486 loops=1) Sort Key: XXXX.idcode -> Hash Join (cost=36.50..2136.54 rows=11016 width=31) (actual time=3.41..765.49 rows=19486 loops=1) Hash Cond: ("outer".idcode = "inner".idcode) -> Seq Scan on XXXX (cost=0.00..1586.34 rows=50134 width=21) (actual time=0.12..301.87 rows=50515 loops=1) -> Hash (cost=36.48..36.48 rows=7 width=10) (actual time=3.10..3.10 rows=0 loops=1) -> Seq Scan on YYYY (cost=0.00..36.48 rows=7 width=10) (actual time=0.13..3.04 rows=6 loops=1) Filter: ((idazien = 8::numeric) OR (idazien = 1019::numeric)) -> Index Scan using YYYY_pkey on YYYY (cost=0.00..5.46 rows=1 width=19) (actual time=0.17..0.18 rows=1 loops=6) Index Cond: (YYYY.idcode = "outer".idcode) Filter: ((idazien = 8::numeric) OR (idazien = 1019::numeric)) Total runtime: 12065.05 msec (23 rows) -- francescosaf ------------------------------------------------------------------------ Posted via http://www.webservertalk.com ------------------------------------------------------------------------ View this thread: http://www.webservertalk.com/message189539.html