Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vn1Cq-0004KL-2c for pgsql-performance@arkaria.postgresql.org; Sun, 01 Dec 2013 07:12:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Vn1Cp-00088l-ED for pgsql-performance@arkaria.postgresql.org; Sun, 01 Dec 2013 07:12:39 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vn1Co-00088e-9m for pgsql-performance@postgresql.org; Sun, 01 Dec 2013 07:12:38 +0000 Received: from mailout01.ims-firmen.de ([213.174.32.96]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Vn1Ck-0003n3-Rr for pgsql-performance@postgresql.org; Sun, 01 Dec 2013 07:12:37 +0000 Received: from mailin03.ims-firmen.de ([192.168.1.143]) by mailout01.ims-firmen.de with esmtp (envelope-from ) id 1Vn1Ci-0002NX-hE for pgsql-performance@postgresql.org; Sun, 01 Dec 2013 08:12:32 +0100 Received: from [87.170.130.9] (helo=a-kretschmer.de) by mailin03.ims-firmen.de with esmtpsa (TLSv1:AES256-SHA:256) (envelope-from ) id 1Vn1Ci-0001ct-78 for pgsql-performance@postgresql.org; Sun, 01 Dec 2013 08:12:32 +0100 Received: from kretschmer by a-kretschmer.de with local (Exim 4.69) (envelope-from ) id 1Vn1Ch-0001NY-4s for pgsql-performance@postgresql.org; Sun, 01 Dec 2013 08:12:31 +0100 Date: Sun, 1 Dec 2013 08:12:31 +0100 From: Andreas Kretschmer To: pgsql-performance@postgresql.org Subject: Re: Speed up the query Message-ID: <20131201071231.GA4780@tux> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-OS: Debian/GNU Linux - weil ich es mir Wert bin! X-GPG-Fingerprint: EE16 3C01 7B9C 10F7 2C8B 3B86 4DB3 D9EE 7F45 84DA X-Message-Flag: "Windows" is not the answer. "Windows" is the question and the answer is "no"! X-Lugdd: Gerd Kube X-Info: My name is root. Just root. And I am licensed to kill -9 User-Agent: Mutt/1.5.18 (2008-05-17) X-Pg-Spam-Score: -0.0 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Hengky Liwandouw wrote: > > But the problem is : when i change the where clause to : > > where jualid is not null or returjualid is not null > and extract(year from tanggal)='2013') Try to create this index: create index xxx on public.tbltransaksi((extract(year from tanggal))) where jualid is not null or returjualid is not null; an run the query again, and if this not helps show us explain analyse, you can use explain.depesz.com to provide us the plan. Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) "If I was god, I would recompile penguin with --enable-fly." (unknown) Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889° -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance