Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 14E536323F6 for ; Mon, 19 Jan 2009 03:08:59 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 66267-09 for ; Mon, 19 Jan 2009 03:08:56 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.29]) by mail.postgresql.org (Postfix) with ESMTP id 2955563239D for ; Mon, 19 Jan 2009 03:08:56 -0400 (AST) Received: by yw-out-2324.google.com with SMTP id 3so1089791ywj.73 for ; Sun, 18 Jan 2009 23:08:55 -0800 (PST) Received: by 10.65.98.8 with SMTP id a8mr2593786qbm.118.1232348934859; Sun, 18 Jan 2009 23:08:54 -0800 (PST) Received: from ?192.168.1.10? (c-67-188-158-142.hsd1.ca.comcast.net [67.188.158.142]) by mx.google.com with ESMTPS id k27sm9142139qba.22.2009.01.18.23.08.50 (version=SSLv3 cipher=RC4-MD5); Sun, 18 Jan 2009 23:08:52 -0800 (PST) Subject: Re: [PATCHES] GIN improvements From: Jeff Davis To: Teodor Sigaev Cc: Heikki Linnakangas , Tom Lane , Pgsql Hackers In-Reply-To: <49708008.8070109@sigaev.ru> References: <483FD205.4090904@sigaev.ru> <486BC501.6060605@sigaev.ru> <27880.1215810535@sss.pgh.pa.us> <487A6E0C.3090600@sigaev.ru> <8993.1216843701@sss.pgh.pa.us> <4888A594.6010102@sigaev.ru> <490B07BA.6030109@sigaev.ru> <492F04D9.5070404@enterprisedb.com> <4942A137.3000502@sigaev.ru> <1229910966.2285.76.camel@jdavis> <49708008.8070109@sigaev.ru> Content-Type: text/plain Date: Sun, 18 Jan 2009 23:08:25 -0800 Message-Id: <1232348905.7281.114.camel@jdavis> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.125 tagged_above=0 required=5 tests=DNS_FROM_RFC_BOGUSMX=2.125 X-Spam-Level: ** X-Archive-Number: 200901/1360 X-Sequence-Number: 132004 On Fri, 2009-01-16 at 15:39 +0300, Teodor Sigaev wrote: > > START_CRIT_SECTION(); > > ... > > l = PageAddItem(...); > > if (l == InvalidOffsetNumber) > > elog(ERROR, "failed to add item to index page in \"%s\"", > > RelationGetRelationName(index)); > > > > It's no use using ERROR, because it will turn into PANIC, which is > I did that similar to other GIN/GiST places. BTW, BTree directly emits PANIC if > PageAddItem fails > I'd still prefer PANIC over an ERROR that will always turn into a PANIC. I'll leave it as you did, though. > > > > 4. Heikki mentioned: > > http://archives.postgresql.org/pgsql-hackers/2008-11/msg01832.php > > > > "To make things worse, a query will fail if all the matching > > fast-inserted tuples don't fit in the non-lossy tid bitmap." > > > > That issue still remains, correct? Is there a resolution to that? > > Now gincostestimate can forbid index scan by disable_cost (see Changes). Of > course, it doesn't prevent failure in case of large update (for example), but it > prevents in most cases. BTW, because of sequential scan of pending list cost of > scan grows up fast and index scan becomes non-optimal. Is this a 100% bulletproof solution, or is it still possible for a query to fail due to the pending list? It relies on the stats collector, so perhaps in rare cases it could still fail? It might be surprising though, that after an UPDATE and before a VACUUM, the gin index just stops working (if work_mem is too low). For many use-cases, if GIN is not used, it's just as bad as the query failing, because it would be so slow. Can you explain why the tbm must not be lossy? Also, can you clarify why a large update can cause a problem? In the previous discussion, you suggested that it force normal index inserts after a threshold based on work_mem: http://archives.postgresql.org/pgsql-hackers/2008-12/msg00065.php Regards, Jeff Davis