Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZUtMr-00081o-Kl for pgsql-performance@arkaria.postgresql.org; Thu, 27 Aug 2015 09:21:09 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZUtMq-0001VR-B8 for pgsql-performance@arkaria.postgresql.org; Thu, 27 Aug 2015 09:21:08 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZUtMp-0001Th-5n for pgsql-performance@postgresql.org; Thu, 27 Aug 2015 09:21:07 +0000 Received: from e-mailfilter02.sunet.se ([2001:6b0:8:2::202]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZUtMg-0005IA-Rd for pgsql-performance@postgresql.org; Thu, 27 Aug 2015 09:21:05 +0000 Received: from smtp1.nordu.net (smtp1.nordu.net [IPv6:2001:948:4:6::32]) by e-mailfilter02.sunet.se (8.14.4/8.14.4/Debian-4) with ESMTP id t7R9KrGH017200 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 27 Aug 2015 11:20:53 +0200 Received: from kerio.nordu.net (kerio.nordu.net [109.105.110.42]) by smtp1.nordu.net (8.14.7/8.14.7) with ESMTP id t7R9Kn83007028 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 27 Aug 2015 09:20:52 GMT VBR-Info: md=nordu.net; mc=all; mv=swamid.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nordu.net; s=default; t=1440667252; bh=JTmVLvuVf5Gg1ORWY+GCssYlTh8+2HOkGbFwscMvLcA=; h=Date:From:To:Subject:In-Reply-To:References; b=DOdfV1xFVuvhjvmkDJw+31liHG+Crv39fHqqeo6QWo4t/cavDpQqEV7zZBd8aRuIa 7HdOoG/FyvEHzaNKhSNJ0xfIwx+HzSLuKughOQW6K0Kd5XWq1X0o5/hmbKIfZb3Ht8 hArDPifIJVGOpbpbmYbHVd68tRrLSHIaRGmI0DyQ= X-Footer: bm9yZHUubmV0 Received: from pyrite ([130.225.198.224]) (authenticated user htj@nordu.net) by kerio.nordu.net (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256 bits)); Thu, 27 Aug 2015 11:20:47 +0200 Date: Thu, 27 Aug 2015 11:21:12 +0200 (CEST) From: Henrik Thostrup Jensen X-X-Sender: htj@pyrite To: Emre Hasegeli , pgsql-performance Subject: Re: Gist indexing performance with cidr types In-Reply-To: Message-ID: References: User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Scanned-By: CanIt (www . roaringpenguin . com) X-Scanned-By: MIMEDefang 2.74 on 109.105.111.32 X-Spam-Score: undef - 109.105.110.42 is whitelisted. X-p0f-Info: os=unknown unknown, link=Ethernet or modem X-CanIt-Geo: ip=109.105.110.42; country=SE; latitude=59.3294; longitude=18.0686; http://maps.google.com/maps?q=59.3294,18.0686&z=6 X-CanItPRO-Stream: outbound-nordu-net:outbound (inherits from outbound-nordu-net:default, nordu-net:default, base:default) X-Canit-Stats-ID: 0aP9JkRo3 - 879d7af35e49 - 20150827 X-CanIt-Archive-Cluster: PfMRe/vJWMiXwM2YIH5BVExnUnw Received-SPF: neutral (e-mailfilter02.sunet.se: 109.105.110.42 is neither permitted nor denied by domain htj@nordu.net) receiver=e-mailfilter02.sunet.se; client-ip=109.105.110.42; envelope-from=; helo=smtp1.nordu.net; identity=mailfrom X-Pg-Spam-Score: -4.3 (----) 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 On Wed, 26 Aug 2015, Emre Hasegeli wrote: > Can you try to isolate it even more by something like this: I tried some different bisection approaches: -- base query (time ~19 seconds) EXPLAIN (ANALYZE, BUFFERS) SELECT rv.route, rv.asn, rv.source FROM (SELECT DISTINCT route FROM routes_view WHERE asn = 2914 AND [ stuff here ]) r JOIN routes_view rv ON (r.route && rv.route); SELECT DISTINCT route FROM routes_view WHERE asn = 2914; -> 732 rows, 0.2 seconds masklen(route) <= 20; -> 356 rows, join time 9.2 seconds masklen(route) > 20; -> 376 rows, join time 9.1 seconds family(route) = 6 -> 22 rows, join time 0.2 seconds family(route) = 4 -> 710 rows, join time 18.1 seconds route <= '154.0.0.0' -> 362 rows, join time 9.2 seconds route > '154.0.0.0' -> 370 rows, join time 9.5 seconds Nothing really interesting here though. > select * from routes where route && 'a.b.c.d/e'; > > It would be easier to debug, if we can reproduce performance > regression like this. It would also be helpful to check where the > time is spent. Maybe "perf" on Linux would help, though I haven't > used it before. Haven't used this before either (but seem like a nice tool). Output while running the query: Samples: 99K of event 'cpu-clock', Event count (approx.): 11396624870 14.09% postgres [.] inet_gist_consistent 10.77% postgres [.] 0x00000000000c05f7 10.46% postgres [.] FunctionCall5Coll 5.68% postgres [.] gistdentryinit 5.57% postgres [.] 0x00000000000c05c4 4.62% postgres [.] FunctionCall1Coll 4.52% postgres [.] MemoryContextReset 4.25% postgres [.] bitncmp 3.32% libc-2.19.so [.] __memcmp_sse4_1 2.44% postgres [.] 0x00000000000c08f9 2.37% postgres [.] 0x00000000000c0907 2.27% postgres [.] 0x00000000000c0682 2.12% postgres [.] pg_detoast_datum_packed 1.86% postgres [.] hash_search_with_hash_value 1.40% postgres [.] inet_gist_decompress 1.09% postgres [.] 0x00000000000c067e 1.03% postgres [.] 0x00000000000c047e 0.77% postgres [.] 0x00000000002f0e57 0.75% postgres [.] gistcheckpage This seemed to stay reletively consistent throughout the query. Best regards, Henrik Henrik Thostrup Jensen Software Developer, NORDUnet -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance