Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X5Shh-00054W-So for pgsql-performance@arkaria.postgresql.org; Fri, 11 Jul 2014 04:45:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1X5Shh-0002dD-C5 for pgsql-performance@arkaria.postgresql.org; Fri, 11 Jul 2014 04:45:01 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1X5Shg-0002d4-5J for pgsql-performance@postgresql.org; Fri, 11 Jul 2014 04:45:00 +0000 Received: from mailout02.ims-firmen.de ([213.174.32.97]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1X5Shc-0006ry-3z for pgsql-performance@postgresql.org; Fri, 11 Jul 2014 04:44:58 +0000 Received: from mailin04.ims-firmen.de ([192.168.1.144]) by mailout02.ims-firmen.de with esmtp (envelope-from ) id 1X5ShY-0005Rb-lZ for pgsql-performance@postgresql.org; Fri, 11 Jul 2014 06:44:52 +0200 Received: from [79.200.198.22] (helo=a-kretschmer.de) by mailin04.ims-firmen.de with esmtpsa (TLSv1:AES256-SHA:256) (envelope-from ) id 1X5ShY-0005Mt-Bm for pgsql-performance@postgresql.org; Fri, 11 Jul 2014 06:44:52 +0200 Received: from kretschmer by a-kretschmer.de with local (Exim 4.69) (envelope-from ) id 1X5ShY-00024A-4j for pgsql-performance@postgresql.org; Fri, 11 Jul 2014 06:44:52 +0200 Date: Fri, 11 Jul 2014 06:44:52 +0200 From: Andreas Kretschmer To: pgsql-performance@postgresql.org Subject: Re: GIN index not used Message-ID: <20140711044452.GA7390@tux> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 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: -1.9 (-) 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 Huang, Suya wrote: > Hi, > > > > I’ve got a table with GIN index on integer[] type. While doing a query with > filter criteria on that column has GIN index created, it’s not using index at > all, still do the full table scan. Wondering why? Try to add an index on the date-column. Btw.: works for me: ,---- | test=*# \d foo; | Table "public.foo" | Column | Type | Modifiers | --------+-----------+----------- | id | integer | | ts | integer[] | | Indexes: | "idx_foo" gin (ts) | | test=*# set enable_seqscan to off; | SET | Time: 0,049 ms | test=*# select * from foo; | id | ts | ----+------------ | 1 | {1,2,3} | 2 | {10,20,30} | (2 rows) | | Time: 0,230 ms | test=*# explain select * from foo where ts @> array[2]; | QUERY PLAN | ---------------------------------------------------------------------- | Bitmap Heap Scan on foo (cost=8.00..12.01 rows=1 width=36) | Recheck Cond: (ts @> '{2}'::integer[]) | -> Bitmap Index Scan on idx_foo (cost=0.00..8.00 rows=1 width=0) | Index Cond: (ts @> '{2}'::integer[]) | (4 rows) `---- 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