X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 24F06D1B503 for ; Sat, 27 Sep 2003 17:14:19 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 56519-07 for ; Sat, 27 Sep 2003 14:14:09 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 3EAB3D1B502 for ; Sat, 27 Sep 2003 14:14:02 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8RHE26c006355; Sat, 27 Sep 2003 13:14:02 -0400 (EDT) To: rantunes@student.dei.uc.pt Cc: pgsql-performance@postgresql.org Subject: Re: Indices arent being used In-reply-to: <200309271448.h8REmwXA008210@student.dei.uc.pt> References: <200309271448.h8REmwXA008210@student.dei.uc.pt> Comments: In-reply-to rantunes@student.dei.uc.pt message dated "Sat, 27 Sep 2003 14:48:58 +0000" Date: Sat, 27 Sep 2003 13:14:02 -0400 Message-ID: <6354.1064682842@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/336 X-Sequence-Number: 3702 rantunes@student.dei.uc.pt writes: > Here is the explain analyze of the query: > explain analyze select count(*) from actvars, prodlevel where > actvars.product_level=prodlevel.code_level and > prodlevel.division_level='OY3S5LAPALL6'; > [ slow merge join ] I wonder whether a hash join wouldn't work better. Can you force a hash join? (Try "enable_mergejoin = 0" and if needed "enable_nestloop = 0"; don't disable seqscans though.) If you can get such a plan, please post the explain analyze results for it. > This method forces the indices to work but it looks like it takes a long to > finish executing, I had to cancel the query after 10 min. "Force use of the indexes" is not always an answer to performance issues. regards, tom lane