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 1p2ZI9-00049G-FU for pgsql-admin@arkaria.postgresql.org; Tue, 06 Dec 2022 14:51:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p2ZI8-0004de-Cg for pgsql-admin@arkaria.postgresql.org; Tue, 06 Dec 2022 14:51:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2ZI8-0004cv-0E for pgsql-admin@lists.postgresql.org; Tue, 06 Dec 2022 14:51:28 +0000 Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p2ZI5-0001Av-CC for pgsql-admin@lists.postgresql.org; Tue, 06 Dec 2022 14:51:27 +0000 Received: by mail-oi1-x22a.google.com with SMTP id q186so17149285oia.9 for ; Tue, 06 Dec 2022 06:51:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=IOhvyMgf4E/Uh0dtATp7PxnvxWvPMq6BDYNGMBvhKcA=; b=d/sdJWvv+hX8sju3nu+UNBSiPFSeecoT2vMPb4eCjdvU4pzxpcXFjEH9lOrse1h0ct 01gUZvcY8YNeu0m+7EYBwls/cFhwdIIrhr0N1d9Em2NMRT9PjaWLiwPyhn3d+xlF+bHk qb2ytKrixS0dq7VHzl5a3wkrzA49mXvGqbWzUiy4/wJ7D6A2EEdVlQICVXhsn968mz9U FcdXo+Gk0v4R9RV2a6pM4dyYT8uQHwlVA8TcwtaeC5/k09SzieqpLg+TTi6n7ijAyzfq ordkI4FkNsV0h5rpfJqQHNyGAVJr/O97YdFVqzGnLvyRyLLdUVZQ+m4JyCAeIYSbNDAE 3diQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=IOhvyMgf4E/Uh0dtATp7PxnvxWvPMq6BDYNGMBvhKcA=; b=IyYlhdX5aOmjDCVVNbgmK/lT5v5mxvW64IOdLOcnq7y0TpWKUyjwsbEqluhUjL6atO ZLas4DeG7v7V2AxD5UqrAvYvw68IW4QZFsp8RKsfOqoYt+zTdog5h/X5lSdsZFHch2/Y aTQtPgAgmbcsxfSGLA2J7zN4u+iL6G6GTQPcCcuiMiQ7QuS2M+quG/xbPYIA7I4USakp /jw6y3K9jPxtj4QX51/EocBgHhHRuyS8C/Uc7ZmPRnvmRve6s32YpMV40FONHoQd6fGo qEQr62fMPcVRJZYHLmkAye/TYXWYGFJRxe+mZnNScO7zj0bpdE7rSnpNt14zyDYMTPXR +KEw== X-Gm-Message-State: ANoB5pnRcsEXkwrDhnvtVyPMXR1sTCCzGDCQoXi7AMZ9p0GRqSbptanU x9jDzO0chsvNXCqR0mtAPuRWO4FPr9Q= X-Google-Smtp-Source: AA0mqf65J7Nd62Wb6jRFSVrd0apOcs0UUUDjuY2ZjQOvLMoNdeU0Fa2KjUkR3UtNYhqSOKU9bpUTHw== X-Received: by 2002:aca:1e17:0:b0:35b:dd26:5e39 with SMTP id m23-20020aca1e17000000b0035bdd265e39mr12286138oic.137.1670338282558; Tue, 06 Dec 2022 06:51:22 -0800 (PST) Received: from ?IPV6:2600:1700:bd2c:b810::43? ([2600:1700:bd2c:b810::43]) by smtp.googlemail.com with ESMTPSA id c2-20020a4a8f82000000b004908a9542f8sm7912629ooj.31.2022.12.06.06.51.21 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Dec 2022 06:51:21 -0800 (PST) Content-Type: multipart/alternative; boundary="------------y90dWmQ9TPc7eVmrHO4SLsoX" Message-ID: Date: Tue, 6 Dec 2022 08:51:21 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: need suggestion on querying big tables Content-Language: en-US To: pgsql-admin@lists.postgresql.org References: From: Ron In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------y90dWmQ9TPc7eVmrHO4SLsoX Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 12/5/22 00:29, Ebin Jozer wrote: > Hi Team, > in postgresql 11 version we have two tables of size 435 GB and 347 GB. > if we query on single table or if we are doing inner join on both the big > tables, it is not displacing any output, it keeps running > > We can see the wait event is IO and directDatafile . > > Server Spec : 8 cores and  64GB RAM > PG config : 53 GB(effective_cache), 12 GB(shared buffer) > > can you please suggest some ideas , how we can query on big tables and > fasten them to get the output?? https://www.postgresql.org/docs/11/runtime-config-query.html effective_cache_size is how much RAM *a single* query gets. "When setting this parameter you should consider both *PostgreSQL's shared buffers*". https://www.postgresql.org/docs/11/runtime-config-resource.html "a reasonable starting value for *shared_buffers is 25% of the memory* in your system. There are some workloads where even larger settings for shared_buffers are effective, but because PostgreSQL also relies on the operating system cache, *it is unlikely that an allocation of more than 40% of RAM to shared_buffers will work better* than a smaller amount." You've set effective_cache_size to 83%, when it should be at most 20%. -- Angular momentum makes the world go 'round. --------------y90dWmQ9TPc7eVmrHO4SLsoX Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit On 12/5/22 00:29, Ebin Jozer wrote:
Hi Team,
in postgresql 11 version we have two tables of size 435 GB and 347 GB. 
if we query on single table or if we are doing inner join on both the big tables, it is not displacing any output, it keeps running 

We can see the wait event is IO and directDatafile .

Server Spec : 8 cores and  64GB RAM
PG config : 53 GB(effective_cache), 12 GB(shared buffer) 

can you please suggest some ideas , how we can query on big tables and fasten them to get the output??

https://www.postgresql.org/docs/11/runtime-config-query.html

effective_cache_size is how much RAM a single query gets.  "When setting this parameter you should consider both PostgreSQL's shared buffers".

https://www.postgresql.org/docs/11/runtime-config-resource.html

"a reasonable starting value for shared_buffers is 25% of the memory in your system. There are some workloads where even larger settings for shared_buffers are effective, but because PostgreSQL also relies on the operating system cache, it is unlikely that an allocation of more than 40% of RAM to shared_buffers will work better than a smaller amount."

You've set effective_cache_size to 83%, when it should be at most 20%.

--
Angular momentum makes the world go 'round.
--------------y90dWmQ9TPc7eVmrHO4SLsoX--