X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0D87552D38 for ; Wed, 13 Jul 2005 23:53:24 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39299-01 for ; Thu, 14 Jul 2005 02:53:21 +0000 (GMT) Received: from hub.org (hub.org [200.46.204.220]) by svr1.postgresql.org (Postfix) with ESMTP id 1026152D0C for ; Wed, 13 Jul 2005 23:53:21 -0300 (ADT) Received: from localhost (unknown [200.46.204.144]) by hub.org (Postfix) with ESMTP id 83402A246B6 for ; Wed, 13 Jul 2005 23:53:20 -0300 (ADT) Received: from hub.org ([200.46.204.220]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 39255-01 for ; Thu, 14 Jul 2005 02:53:18 +0000 (GMT) Received: from ganymede.hub.org (blk-224-176-51.eastlink.ca [24.224.176.51]) by hub.org (Postfix) with ESMTP id DCB35A246AF for ; Wed, 13 Jul 2005 23:53:17 -0300 (ADT) Received: by ganymede.hub.org (Postfix, from userid 1000) id 2DB8434EC9; Wed, 13 Jul 2005 23:53:29 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 2807534584 for ; Wed, 13 Jul 2005 23:53:29 -0300 (ADT) X-Return-Path: X-Received: from localhost ([unix socket]) by ganymede.hub.org (Cyrus v2.2.12) with LMTPA; Wed, 13 Jul 2005 20:50:42 -0300 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 5427A3D65A for ; Wed, 13 Jul 2005 20:50:23 -0300 (ADT) X-Received: from mail.postgresql.org [200.46.204.71] by localhost with IMAP (fetchmail-6.2.5) for scrappy@localhost (single-drop); Wed, 13 Jul 2005 20:50:23 -0300 (ADT) X-Received: from svr1.postgresql.org ([unix socket]) by svr1.postgresql.org (Cyrus v2.2.12) with LMTPA; Wed, 13 Jul 2005 20:46:31 -0300 X-Sieve: CMU Sieve 2.2 X-Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B1FA452C58 for ; Wed, 13 Jul 2005 20:46:31 -0300 (ADT) X-Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95818-02 for ; Wed, 13 Jul 2005 23:46:23 +0000 (GMT) X-Received: from nextmail.ru (unknown [83.222.5.149]) by svr1.postgresql.org (Postfix) with SMTP id 302A952C5D for ; Wed, 13 Jul 2005 20:46:21 -0300 (ADT) X-Received: (qmail 24036 invoked from network); 13 Jul 2005 23:45:15 -0000 X-Received: from ppp85-140-125-114.pppoe.mtu-net.ru (HELO z) (85.140.125.114) by nextmail.ru with SMTP; 13 Jul 2005 23:45:15 -0000 From: "jobapply" To: Subject: Indexing Function called on VACUUM and sorting ? Date: Thu, 14 Jul 2005 03:46:23 +0400 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.6353 Thread-Index: AcWIBRPH0sxvB4uyS7CMZ6QrhZOEzw== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Message-Id: <20050713234621.302A952C5D@svr1.postgresql.org> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-DCC: : X-Spam-Pyzor: Reported 0 times. ReSent-Date: Wed, 13 Jul 2005 23:53:21 -0300 (ADT) Resent-From: "Marc G. Fournier" Resent-To: pgsql-performance@postgresql.org ReSent-Subject: Indexing Function called on VACUUM and sorting ? ReSent-Message-ID: <20050713235321.A66818@ganymede.hub.org> X-Virus-Scanned: by amavisd-new at hub.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.946 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200507/205 X-Sequence-Number: 13446 The question appeared because of strange issues with functional indexes. It seems they are recalculated even where it is obviously not needed. \d+ test: i | integer | | t | text | | x | text | | "i_i" btree (i) "x_i" btree (xpath_string(x, 'data'::text)) "x_ii" btree (xpath_string(x, 'movie/characters/character'::text)) "x_iii" btree (xpath_string(x, 'movie/rating'::text)) 1) When I run VACUUM FULL ANALYZE VERBOSE OR VACUUM ANALYZE After text INFO: analyzing "public.test" INFO: "test": scanned 733 of 733 pages, containing 10000 live rows and 0 dead rows; 3000 rows in sample, 10000 estimated total rows a lot of xpath_string calls occur. Does VACUUM rebuild indexes ? What for to recalculate that all? It makes VACUUMing very slow. Simple VACUUM call does not lead to such function calls. 2) When I do select * from test order by xpath_string(x, 'movie/rating'::text) limit 1000 offset 10; Planner uses index x_iii (as it should, ok here): Limit -> Index scan. But many of calls to xpath_string occur in execution time. Why ? Index is calculated already and everything is so immutable.. Please answer if you have any ideas.. Functional indexes seemed so great first, but now I uncover weird issues I can't understand..