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.96) (envelope-from ) id 1wBaMs-001COE-1B for pgsql-admin@arkaria.postgresql.org; Sat, 11 Apr 2026 15:35:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wBaMq-00GsC6-1p for pgsql-admin@arkaria.postgresql.org; Sat, 11 Apr 2026 15:35:29 +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.96) (envelope-from ) id 1wBaMq-00GsBx-0a for pgsql-admin@lists.postgresql.org; Sat, 11 Apr 2026 15:35:29 +0000 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wBaMo-00000000VV5-2x5J for pgsql-admin@lists.postgresql.org; Sat, 11 Apr 2026 15:35:27 +0000 Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-43d70c30767so6913f8f.0 for ; Sat, 11 Apr 2026 08:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1775921724; x=1776526524; darn=lists.postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=wPmBReNRpfAMOlNAOmV0xOhxFxpV3XKfapPn/hAa8PE=; b=Y1Miy0mBMkpIVmUp7kTWYFvfadrrfqDhJn5xpjMtzPJhpmIn6X8QNBR/paZcBYFuH0 RP0a/UNN8pqZ+Wd/VMA1RFAtI5xBzdUb0lhTIb3/sjlOKcQqVHIePtUL2W4gGMbNSSSl KKjqXx21LZDzSetLqQTcRlr/6W51BhGhlRqWhoMGUZzro9yDi607vkbZniLqexilopYw EwNjZyeEkANQ0mAXhObjPEPj+4gLPQ7efLLRwjydD6o9b8Mza6Pdjeo1Ky+z0SguGWZw F/v2MJocNiZQ00nZ/3oqPIx5y6IVmxBHu9c02n06AyI2ldOZw6TQB6AUR4fhRzs6WlTh 55wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775921724; x=1776526524; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wPmBReNRpfAMOlNAOmV0xOhxFxpV3XKfapPn/hAa8PE=; b=IU5ETjGN9qigmFWwruzcejuwqscEZhz82FppXRIKRAnAhlnwVbCWVR0QwmN1/iubbU Aoeyk/aNvUnTZPGuxzMdOGKOsgIOpezNEk5yyeqT6BBDSPUQ2qNs5Ucak/hZkz4myzIA lK9N9pP4hASevunQMC5bkEYkbYWDu4RcyoGJWD/5vfJQsrD+ces8OxMwg0lf7HggEc3o V1Z71J6bG02FsDfchvqRxeSWbYa7jKQuOGB0j5JF4DJvXbCObZEnXCbnOijEYveIBMRh iwPNtetold4j61oXyZrSuQ4wW9I1CbBlVZ0pJU3wpXq2LfgV/1riL9aq4rEs8ACRwdEE KW+A== X-Forwarded-Encrypted: i=1; AJvYcCV7bw91d6mPiyeijIKARu4qxfBs8hSUrVvrNepWbiFOtaI4z+uXnfU03nHArRHZpleiTp3Fxepsjvqxcw==@lists.postgresql.org X-Gm-Message-State: AOJu0YwP8OErSWopoF/SuGMbq8s1kwdTS1eUTE4JKKS3I9euvdq8L2X2 7Py0ooj6ev2ObvgTZ1OEveTWZSywvFYJvsGjAbQ6dDLBI3i7+ZRv9fSFEQ9bwaAMTls= X-Gm-Gg: AeBDietnfHQjU0ioUA+RzFMvLvIhNpRjZuDXi5TazAR96EI35TdMwTtP75er3v9jgwB 9ViTjgnqnjIPtGOy5BoXlm0KZXdzrP5vkmkpdXgqN7uw/Vf/+qdTNZHMlnTfHzZuVLgN74bQxdM P1BjnFoBICIofgJenWXvfBlabK8L9V+yxkTIla3+Jl/IhFjPWJRjPxiHxUwvJcXmuU2ps1t5VY9 jHRsmWTzlDpQqsCs/PweSZxsx19euE4AUXxjlm0zfDYJYKbqo/QebWLuoRaT+zBqdQDsqcReuiR KprXy5leUBazm3J8jSTOGEO+jjpp+/XP2dqfJsj1CAhBRj8HAfoIMjlJ9qzeR38OGWOGUSFcKLU Hr1gQ9R5aQygHRZ7+yISGjh9siW17zUQeJxnEo9R8v7pbeHSoEEkjGYy5HYXyiuQFsj35DzH9Tx NsOdVJmymvg/Q2IcnYBW2AXZFsxcH4o8Sm2i5srKv4t4vxoOm3al+R6A== X-Received: by 2002:a05:6000:2482:b0:43c:f81f:3e7b with SMTP id ffacd0b85a97d-43d6492f775mr9450794f8f.6.1775921724124; Sat, 11 Apr 2026 08:35:24 -0700 (PDT) Received: from laurenz.albe-K4N0CV00F97414D ([2001:871:260:35d2:4b8c:dad6:bd6e:cd43]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43d6fc9d525sm992001f8f.36.2026.04.11.08.35.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Apr 2026 08:35:23 -0700 (PDT) Message-ID: Subject: Re: Seeking Advice: PostgreSQL Performance Troubleshooting Without Third-Party Tools From: Laurenz Albe To: mahamood hussain , Pgsql-admin Date: Sat, 11 Apr 2026 17:35:23 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 2026-04-10 at 23:18 +0530, mahamood hussain wrote: > From a DBA perspective, I=E2=80=99m looking to proactively identify probl= em areas=E2=80=94such as: > =C2=A0* Long-running queries log_min_duration_statement =3D 2000 > =C2=A0* Jobs/stored procedures consuming high temp space SELECT temp_blks_written, query FROM pg_stat_statements ORDER BY temp_blks_written DESC LIMIT 10; > =C2=A0* Queries resulting in sequential scans due to missing indexes There is no direct way to find that. First, look at tables that receive large sequential scans frequently: SELECT relid::regclass, seq_scan, seq_tup_read FROM pg_stat_all_tables ORDER BY least(seq_scan, seq_tup_read) DESC LIMIT 10; Then examine the long-running queries that consume a lot of database time: SELECT total_exec_time, query FROM pg_stat_statements WHERE mean_exec_time > 100 ORDER BY total_exec_time DESC LIMIT 10; See if any of those use one the tables found with the first query. Then use EXPLAIN (ANALYZE, BUFFERS) on the statement to get the execution p= lan and tune the query if you can. > =C2=A0* Lock waits, deadlocks, and memory-heavy operations log_lock_waits =3D on Deadlocks are logged automatically. Memory use is not tracked. Yours, Laurenz Albe