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 1sUPhe-002slq-LE for pgsql-general@arkaria.postgresql.org; Thu, 18 Jul 2024 11:53:42 +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 1sUPhc-00FBQ7-IN for pgsql-general@arkaria.postgresql.org; Thu, 18 Jul 2024 11:53:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sUPhc-00FBPy-1l for pgsql-general@lists.postgresql.org; Thu, 18 Jul 2024 11:53:40 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sUPha-000C8L-1F for pgsql-general@lists.postgresql.org; Thu, 18 Jul 2024 11:53:39 +0000 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5a156557029so764212a12.2 for ; Thu, 18 Jul 2024 04:53:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=peoplecall-com.20230601.gappssmtp.com; s=20230601; t=1721303617; x=1721908417; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=zMaymexWRtEcbscWk86XmkTihyzgdLnuQ2oC9mLYwaA=; b=bCHWR1L0gd2yvOEfydSK71ubOrAbu3bl3Ib/eMPPO4t1CJzYmBw0YvK61+xhUUc1y6 cG0BRG6919UWpH0FMYJYz1lehT7YTAxabhSU05n3CPvZXtAHJcxYIjc5gc09UJjgpzrj pBZLpSW4y3oIdaqm9PRGgtp4yH8GoDUkUy+Zvbq4OGVolUMz3rXeDzw2tkGraEZRyXct wTinc9caG8etEuDh+pOS0S+lBbhs0PKusz8M21x0p5sdBQKikw4IBSXgnaN/0f5ss1ex EsOf3gdxepa7YYX6Y7Tjh5RbBiOceSB5Imb3o+hda4upqWABtzrEsIUyV6cMYZ2Hd1q9 xtuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721303617; x=1721908417; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zMaymexWRtEcbscWk86XmkTihyzgdLnuQ2oC9mLYwaA=; b=Xaur4vL7jo8rEI1zdx7UzbcerK5UqKxaRP1Jvc13tMq3ZOW4nvUwhmpBfBTQar6iGJ 3k8zg0Xov4+c/HBAnt3ess+eiEqCA8CT68qD+Iv7TUrBBidvz/bK2lu9cJtJpIxKpaPi JIA7iiCi1dVkdnNaqyu0NtGPjZEZOJfDSwkREoWraHHEZmU7JjC1r5JMm/Oj6Am0J9hS c7Ax2sLwkh+KOfGNGbik65jtBxv7ezj1Z340LAZRRF2i0KcCovhWyjr6T1X+0pFSqyvi 9j/DvcrdzkedDuHDsAg0/MnTFHhS2O8sC8W33a+8Fo9Q2eiQ2HxIncreNftBkOxzSW75 3azA== X-Gm-Message-State: AOJu0Yz5JOdZfFn0xiDrrKIMivkTFuSGZKOPugAh0POrrX7IFpKItjxu oHl0UQChdT4/NTSq7595SCIMiwRdp91n26f6c/QrF0k47AAArbL8eFKb42DUcaOqYBMA5vXb8se WT6SEl4cWVd3dbDlIL9u4hcZaiXmuWwuMYx/lBnGbmZ4Vr4A= X-Google-Smtp-Source: AGHT+IFwyo1iFms+NVNhjdZ4kqkAav36Po1vH2SYo5xhcm+AA5SVUSrjXtvjl4qznKt3lr1qQLh/w2KzFA+KQH3FObY= X-Received: by 2002:a05:6402:2786:b0:57c:78fb:1a32 with SMTP id 4fb4d7f45d1cf-5a05bfa9fb3mr3431349a12.19.1721303616285; Thu, 18 Jul 2024 04:53:36 -0700 (PDT) MIME-Version: 1.0 References: <937562047.1752859.1721295502145.ref@mail.yahoo.com> <937562047.1752859.1721295502145@mail.yahoo.com> In-Reply-To: <937562047.1752859.1721295502145@mail.yahoo.com> From: Francisco Olarte Date: Thu, 18 Jul 2024 13:53:00 +0200 Message-ID: Subject: Re: Re. Select with where condition times out To: "sivapostgres@yahoo.com" Cc: Postgresql General Group Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 18 Jul 2024 at 11:38, sivapostgres@yahoo.com wrote: > Hello, > PG V11 > > Select count(*) from table1 > Returns 10456432 > > Select field1, field2 from table1 where field3> '2024-07-18 12:00:00' > Times out How do you send the query / how does it time out? Is that the real query? Is table a table or a view? What does explain say? > Any possible way(s) to do this? If your client is timing out, increase timeout, if imposible you can try fetching in batches, but more detail would be needed. Suggestions to improve total time had already being given, try to decrease bloat if you have it, but AFAIK timeouts are configurable, so it may just be you have a too low timeout. If it had been working, is field3 indexed? How is the table modified? Because with a configured timeout, whit an unindexed table ( forcing a table scan ) the query may be working for years before you hit the bad spot. Also, the query includes todays date, so I doubt it has been used for years, probably "a similar one has been used for years", and probably that is not your real table ( or you have a naming problem ). Without giving real info, people cannot give you real solutions. Francisco Olarte.