Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bRzhE-0007tO-2v for pgsql-performance@arkaria.postgresql.org; Tue, 26 Jul 2016 10:34:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bRzhD-00006P-MH for pgsql-performance@arkaria.postgresql.org; Tue, 26 Jul 2016 10:34:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bRzhC-00005t-Mz for pgsql-performance@postgresql.org; Tue, 26 Jul 2016 10:34:42 +0000 Received: from mail-qt0-x236.google.com ([2607:f8b0:400d:c0d::236]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bRzh7-0003e3-J6 for pgsql-performance@postgresql.org; Tue, 26 Jul 2016 10:34:41 +0000 Received: by mail-qt0-x236.google.com with SMTP id 52so1437520qtq.3 for ; Tue, 26 Jul 2016 03:34:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=uAIuDH+v7ysORL+1fRryTSh9AAd9FJWbZZsFhwwgF90=; b=RxY8sIiCTnKa/8+oAkeXtr7/RIGdnkyow5HM2jvRnUj04soD6GOTVVOv8SoB5bHXG+ Obsb9Kww2l2xC3zjiOgk06gntBhB+4umQ+L0KiCJ0HQKfphGP2PGwIqpT6N3jwXtT5Sm FjUUxnt2z7RcIiGk8ZWbTXuZEIDJNyXKbwv1g8AahF132wN3iIWTi8FpdW2W7v+Qs8eZ AAbhHj/MKBlobP44JzMNkmCd/1nE/FcIQ8yjaZpSvY8iMHXRvOf7VKIC0zKS2tRyw0fN isU+C4Eb+M5RkTKE61sa0e/XvB5Rf1uFLuvWcX0pNcfTi5bGjeDRSDMtqmlv1CXwfJjJ jgVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=uAIuDH+v7ysORL+1fRryTSh9AAd9FJWbZZsFhwwgF90=; b=drvmOPjRa8bhn5WTINunsxWC4l8oXxoWgW9hHl0NUO7J0kZkk2o3lZOhnVbh1ZJXMa 3ssJXQlxmT3QsL5ZYZYyHaxCfhNmJJzLbUe9RskDouugbaDuaW1xIrih41jyL+i/ZYsr rqZLNGyas1DfjRDIX19PmQu5NwindDJRKNPoSHyXXi6g8s52mVfYcUtvByBjEcq36K00 TiH+I7aKLnkW7TKy33QaYR8EfX61GlVH/CdgRCvU1QYq73/uKUL4IOCOHn6T7yNmtHXU VOj/FFMGU9v/XjvDCHWR/GVhTgP3+SN96DjHGnE+ldhY1l/Aj2MwKwLnTqDxVPw/3p0P uJuQ== X-Gm-Message-State: AEkoouuDCZ3n+6ecqyVa6s6AeTR4oEKWW1LRo3At0Nj70CLNCi6qbCW+c2/0xN06jYNIaqD/kwIZ3LE+w3f9BAEtVSXznTUydmDg06lCE3sO/gfmRHFmrz+mzcCNdOLQtF9GuHwa8Xqe3RKAV+/d8fRlPAs+5BcEfGtKZPH8r0AfQ1uGG+OWrs8lioZ1LxKFZ0LADZHcjQ== X-Received: by 10.200.37.252 with SMTP id f57mr38378971qtf.68.1469529275766; Tue, 26 Jul 2016 03:34:35 -0700 (PDT) Received: from alderaan.marques (fweduroam.unl.edu.ar. [190.122.240.184]) by smtp.googlemail.com with ESMTPSA id j38sm90976qtj.35.2016.07.26.03.34.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Jul 2016 03:34:35 -0700 (PDT) Subject: Re: Very slow query (3-4mn) on a table with 25millions rows To: Abadie Lana , Tom Lane References: <4248.1469470017@sss.pgh.pa.us> Cc: "pgsql-performance@postgresql.org" From: =?UTF-8?Q?Mart=c3=adn_Marqu=c3=a9s?= Message-ID: <24ade69a-70bf-4cb1-75ae-03a5481f067a@2ndquadrant.com> Date: Tue, 26 Jul 2016 07:34:17 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Pg-Spam-Score: -2.6 (--) 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 El 26/07/16 a las 06:01, Abadie Lana escribió: > Hi Tom, > Thanks for the hints.. > > I made various tests for index > The best I could get is the following one with > create index vat_funcvaratt_multi_idx on functionalvarattributes(split_part(split_part(attvalue,' ',1),'.',1), tag_id, atttype_id); > analyze functionalvarattributes; I suggest running analyze over the other tables involved in the query (or over the whole DB) and then sending back the explain analyze, or even better EXPLAIN (ANALYZE,BUFFERS). Some estimates are close and others are really wrong. I'm not saying that's going to give you a big bust but we'll be able to see the planner with fresh stats -- Martín Marqués http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance