Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sPYKY-0059zn-Gh for pgsql-performance@arkaria.postgresql.org; Fri, 05 Jul 2024 02:05:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sPYJX-004vQd-Eq for pgsql-performance@arkaria.postgresql.org; Fri, 05 Jul 2024 02:04:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sPYJX-004vQV-2n for pgsql-performance@lists.postgresql.org; Fri, 05 Jul 2024 02:04:43 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sPYJV-000SW4-2q for pgsql-performance@lists.postgresql.org; Fri, 05 Jul 2024 02:04:42 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-70b05260c39so582531b3a.0 for ; Thu, 04 Jul 2024 19:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720145080; x=1720749880; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=O8oWRGy3q4J5MZZwnhhlh3cTl8TOpYoTsjiq+yocwzU=; b=ZBu9IqPCW0GEjypVz5klc+NLHoieL6iOdvThl/qZqiw1MA/oG+hmPq4bxe4j0NtEGf AVQV0PY2rMRjzGnPn5kBdMy/Uy+rbReQ2n4cfrq6ZnrIyBOiSgFRw3RvWRqHQwyqNcCC CXQTz6Wyw40T/Z2zYau0+a3iOiew8pceCGm5O6lwEHw+dqiNJMxQwCFZf5XEL2bfKPVf 9ohrBIpDpbdbr55g0EWqOxjHCvaAJ8VCMR6f2FsggIn/NfJjoRD9XlKQFrGhlBkd/9HH znA/rMG7CDucl2ZYyzxqKWA/8Wp7GOHf1ROoJ3TpqapQ2d6vUxacGjzzm0JHPfC042vB 9bPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720145080; x=1720749880; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=O8oWRGy3q4J5MZZwnhhlh3cTl8TOpYoTsjiq+yocwzU=; b=Nbabj9XggUk7uNguZhXOPpGWZ+fF1eVI0U9p/pcC9K+R0YWGOm0VRJh0thnMfdkB9t Gu0aMxOp3+a9W3cv8GS1cAnegUc2LuvdEgQ6GIDohcQdvEnyVnhL34b8cVUNcnQptchd T8gl7a5yTugkO+G0vkAiUpr5LFFDkaaOQaSUebJkrivRKcz7tK/leNvYiPIf2yXg0Jch Za5cePn3/OuLRtxfibsqvtmSxA9SsJT91pFNY5BKeCK5kCPIcmVbrydGYb/v6alRwq4Z WyVbU2td9rLTspvFScmAAiSzEF77m1Dx1z6UM04WFpvCu2uKFiZFqm81tCsog401/Vs2 Hyjg== X-Forwarded-Encrypted: i=1; AJvYcCXNiXTbAzERdOMb6T3f1JUp0Sg93aitMbCkDEuN8O7W5tGO+Z+lW2kaMcD6+cGcr2QMwFCjGp6IhEDU3m5O9o276S80rgZlwB5LwdjOsKL3EpKDea9bzw== X-Gm-Message-State: AOJu0YxZ6YrWPYjEIkw+3p806kny3USaV1ncBikO647SlhnA3SaWYJuq Yy1mQzUS8qEF+mbN2x+IeY+sdXtxzZwMw32KDW5vmApOhQkRZEFv X-Google-Smtp-Source: AGHT+IHxL/YcBYPrCpOTBnkw7lcHavPKulMDM9OThK+/tqcaKufB8SZu6hODyG4lkmP79pswfgJsBg== X-Received: by 2002:a05:6a20:8426:b0:1bf:2cd:8aa9 with SMTP id adf61e73a8af0-1c0cc8c9651mr3531797637.40.1720145079864; Thu, 04 Jul 2024 19:04:39 -0700 (PDT) Received: from [172.20.10.6] (ppp-49-237-44-61.revip6.asianet.co.th. [49.237.44.61]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1fac1596636sm129669835ad.254.2024.07.04.19.04.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 04 Jul 2024 19:04:39 -0700 (PDT) Message-ID: Date: Fri, 5 Jul 2024 09:04:31 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: How to solve my slow disk i/o throughput during index scan To: FREYBURGER Simon "(SNCF" VOYAGEURS / DIRECTION GENERALE TGV / DM RMP YIELD "MANAGEMENT)" , "pgsql-performance@lists.postgresql.org" , Peter Geoghegan References: Content-Language: en-AU From: Andrei Lepikhov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/4/24 22:23, FREYBURGER Simon (SNCF VOYAGEURS / DIRECTION GENERALE TGV / DM RMP YIELD MANAGEMENT) wrote: > Hello, > > Thank you, splitting in β€œOR” query definitely enables bitmap heap scans, > and thus parallelized read to disk πŸ˜ƒ! I though did not understand your > second point, what is parallel append, and how to enable it ? Just for example: DROP TABLE IF EXISTS t CASCADE; CREATE TABLE t (id int not null, payload text) PARTITION BY RANGE (id); CREATE TABLE p1 PARTITION OF t FOR VALUES FROM (0) TO (1000); CREATE TABLE p2 PARTITION OF t FOR VALUES FROM (1000) TO (2000); CREATE TABLE p3 PARTITION OF t FOR VALUES FROM (2000) TO (3000); CREATE TABLE p4 PARTITION OF t FOR VALUES FROM (3000) TO (4000); INSERT INTO t SELECT x % 4000, repeat('a',128) || x FROM generate_series(1,1E5) AS x; ANALYZE t; SET enable_parallel_append = on; SET parallel_setup_cost = 0.00001; SET parallel_tuple_cost = 0.00001; SET max_parallel_workers_per_gather = 8; SET min_parallel_table_scan_size = 0; SET min_parallel_index_scan_size = 0; EXPLAIN (COSTS OFF) SELECT t.id, t.payload FROM t WHERE t.id % 2 = 0 GROUP BY t.id, t.payload; Group Group Key: t.id, t.payload -> Gather Merge Workers Planned: 6 -> Sort Sort Key: t.id, t.payload -> Parallel Append -> Parallel Seq Scan on p1 t_1 Filter: ((id % 2) = 0) -> Parallel Seq Scan on p2 t_2 Filter: ((id % 2) = 0) -> Parallel Seq Scan on p3 t_3 Filter: ((id % 2) = 0) -> Parallel Seq Scan on p4 t_4 Filter: ((id % 2) = 0) Here the table is scanned in parallel. It also works with IndexScan. -- regards, Andrei Lepikhov