Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jKOnS-0005TZ-39 for pgsql-performance@arkaria.postgresql.org; Fri, 03 Apr 2020 16:03:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jKOnR-0006kh-1p for pgsql-performance@arkaria.postgresql.org; Fri, 03 Apr 2020 16:03:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jKOnQ-0006ka-Qk for pgsql-performance@lists.postgresql.org; Fri, 03 Apr 2020 16:03:52 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jKOnO-0004LY-Gw for pgsql-performance@postgresql.org; Fri, 03 Apr 2020 16:03:51 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 80F121C3998F2 for ; Fri, 3 Apr 2020 09:03:49 -0700 (MST) Date: Fri, 3 Apr 2020 09:03:49 -0700 (MST) From: dangal To: pgsql-performance@postgresql.org Message-ID: <1585929829525-0.post@n3.nabble.com> Subject: slow query MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Dear I have a question to ask you I am having a slow problem with a query and I am seeing with the explain that the current cost and time differ by 4 times Postgres version 9.5.16 in centos 7.6 To try to solve this run the statistics to the table and the same problem remains It's a very big table 2 billion tuples Do you have any idea what I can do to improve Thank you very much for your time Any data you need I can provide I share a part of the explain Hash Right Join (cost=11114339.65..12172907.42 rows=886647 width=158) (actual time=1906344.617..1963668.889 rows=3362294 loops=1)" " Output: ba.bus_ent_inst_id_auto, ba.att_value_1, ba.att_value_num_1, att_call.ent_inst_att_str_value, att_nro.ent_inst_att_str_value, att_bis.ent_inst_att_str_value, att_pad.ent_inst_att_str_value, att_manz.ent_inst_att_str_value, att_a (...)" " Hash Cond: ((att_barr.env_id = ba.env_id) AND (att_barr.bus_ent_inst_id = ba.bus_ent_inst_id_auto))" " Buffers: shared hit=5814458 read=1033324 dirtied=790" -- Sent from: https://www.postgresql-archive.org/PostgreSQL-performance-f2050081.html