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 1p2ZPx-0004M8-LD for pgsql-admin@arkaria.postgresql.org; Tue, 06 Dec 2022 14:59:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p2ZPw-0007yC-GR for pgsql-admin@arkaria.postgresql.org; Tue, 06 Dec 2022 14:59:32 +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 1p2ZPw-0007y3-4q for pgsql-admin@lists.postgresql.org; Tue, 06 Dec 2022 14:59:32 +0000 Received: from mout.gmx.net ([212.227.17.21]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2ZPt-0001EU-K4 for pgsql-admin@lists.postgresql.org; Tue, 06 Dec 2022 14:59:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=s31663417; t=1670338767; bh=epGDODChODhDkCdR+GpuVS3lXjIFze16kmyb2wWsjTQ=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=AP2bkNKVP8KKe72y1AhATQuPEPI8uV0iGwFkxq9dIhzB0q4AgsgOPNcgDk1c4xHDn VdHncLWUVCnpetwJyjHuvZlfiDpmnUFm6qzxU+Hge6v6/PHLj4Io09d3VlLiT3iE5q jSkiz0q10JztePXZNgkox3lp7hYVB/ulScEqea3Mxh8X1vBGTy8Ve1mUx+p8secGBq p0PJMDFwznCRptuAYKli0+cr9nG8McKPBHB/dSeZGCDtHhpoKEZi+GLV0+fVpfZgrq ia3yGYvN1flMh7bajzK56eC/4nadrrBDDoDjg0kMnX91qIdHiJlplgEtgzAYk27SNA 7bT+dU2SZ7DlA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [10.8.0.83] ([185.40.248.10]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M89Gt-1p68Bo1Det-005L6D for ; Tue, 06 Dec 2022 15:59:27 +0100 Subject: Re: need suggestion on querying big tables To: pgsql-admin@lists.postgresql.org References: From: Thomas Kellerer Message-ID: Date: Tue, 6 Dec 2022 15:59:16 +0100 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:1hAbQlYejoQrLFd6EoC8odLoJC89E35SJdnb3gCI0xneY0fQdeJ algKzFU37OCQ0SrsoPO0Ga+9Za2zq9GPyg/aOUFcZO8FPQqDVhBaqUGSx9GfLrTKZdbnqZC j/TGQouXwAoEloiXEIHsxM3rfgLiCzdEX4m1fKVQzYAF5B1Q5KucqPIZekAWpurxI/ih07u PwZU+4sRN6em9JkjToMKA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:ZcmioymvfPw=;xIuG2q8oMayJJpn2gCb2U5CxBuZ PrDlKlk/u52RUSSHDlmigzcGC5113guxO3knMUWIvXiyRgmXWSnNMBDQ/psMEHjrp9BCr5LG5 UDS3MZ5VwHQlDCkEe7uX6PU60gX0oPUPNlX2+7w0ui4MnUqbeTjw6YPYYVdiiUKPPMjozMLth qRjWhciie8y/PZcTinCz5l+0eAU2+pIR/l3GUTctqjh38tuhaI28GQUpS5Y9zC8SUCg7tGyU6 k34/3ggsvbbX8wkcYZKn54dFk1WsPIoeUwEFyErO0j1yAP6cr8Sl3EWCodT150fuqf3aS5LFB bKVhOV6o1+s62cdilSLNN2EK8S7+BKayK75kkB5UqQBg7KI1dlhG2T4vAP1qordxPopKetiOE XkbSZUrxvrh6HRS7CkARc8vy/s+cUegjlbUiKJeVYIYM+t5Wy1hWqzQWG7rHmz1DhumnDdyUm E3EKG54hCNWUITF7ftq7YzjPOiJpBzC1YMNcAp6fDVCVFpZJm+Z6E9tu1ramQWwWGntCIvxk3 OgoIRm3FXWYBySe80qg4ThN+HeFXmVhYKKa9uZit4OTaO+V1pz87PoJXKGALOWfYC5HCeQIeA ldV98WhwlYeUtgS6JYKGkeqZ5NJgWHJvcNN3X0TEZQoCJlTruOwtGcchUJ6YDVIX0WPjzoG3g i0gCmtiOUx8l255xjS5XCksdIdyyN0vDTfuFjy2461JvUv6HPCOc/W5kyxJ6hIY1GQ6o/UpZz ASeteOeAUI8ovbzGNWMzelbQshR36DcGm9QPQYJwr/CZ/nrSeWgldsO0QpYU7Ae3Z3eHH5tT2 9TdIZJ55ujn06ImJ0PwFJyAmmeGbsFN6dgBLAFXc7nbaR9a8w22lTv8545RekLmuJkMdirR/t 5hMQ/bpBfxnp2bJM60dR8mu4EpiT36Eho0ECrMCR4Yu8V/TC5BgLlCDIxQFJDq/KoMpCG0IDA a/FVoKUNP+XdeMt+c9Ng9+009FA= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ron schrieb am 06.12.2022 um 15:51: >> 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%. effective_cache_size does not allocate any memory. It's not a setting that controls "how much memory a query gets" effective_cache_size merely a hint to the optimizer on the expected amount of data that is likely to be in the cache. Either the file system cache or shared_buffers. The current setting of 12GB for shared_buffers is absolutely inside the recommended limits. (40% would be about 25GB)