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 1taHpm-000ROB-0F for pgsql-general@arkaria.postgresql.org; Tue, 21 Jan 2025 17:14:38 +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 1taHpl-0028M7-4S for pgsql-general@arkaria.postgresql.org; Tue, 21 Jan 2025 17:14:37 +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 1tZwE8-004s3B-QC for pgsql-general@lists.postgresql.org; Mon, 20 Jan 2025 18:10:20 +0000 Received: from mout.gmx.net ([212.227.15.18]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tZwE5-000ah5-36 for pgsql-general@lists.postgresql.org; Mon, 20 Jan 2025 18:10:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.fr; s=s31663417; t=1737396615; x=1738001415; i=clipperdb@gmx.fr; bh=NYHkufAjhkqp28+Tyt+1ECGXCRWNqkfEPEHIu2t1ESw=; h=X-UI-Sender-Class:MIME-Version:Message-ID:From:To:Content-Type: Date:cc:content-transfer-encoding:content-type:date:from: message-id:mime-version:reply-to:subject:to; b=IhGyvC/ZicRPmjIHEsoOALNXabgDlFIwWFAK2d/ImKtiAPTlmLiDPYjb7sQHuAUX I43FfabQjv47FVrOxmPUM+3k8xrlFK1OYhA5mG+PNo2GtHYnrjOq5S7q81B7R7P9Z NcPk0nS3MNvbV+ofjzSDh87NunyAAzyvx7tPUZPoTETz/qPonfgHwu/3YzuAGUjaW WUPi/Nk19RQE5ZHJgbGdEMgLA4gaDnqpdDvc/G53SWjjzb/HYanseK2hbmIKyzm8W HJbwsJvAh9VfCCBmamsQqeFIX1MjYnkR2TpEATdj10jS76lyY3gMqAbCnZvFT5C2o QaQkBgNsPLeoGr+h1g== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [90.118.59.215] ([90.118.59.215]) by web-mail.gmx.net (3c-app-mailcom-bs15.server.lan [172.19.170.183]) (via HTTP); Mon, 20 Jan 2025 19:10:15 +0100 MIME-Version: 1.0 Message-ID: From: Lana ABADIE To: pgsql-general@lists.postgresql.org Content-Type: text/html; charset=UTF-8 Date: Mon, 20 Jan 2025 19:10:15 +0100 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:631BHvpYwAdnvBf0KU/Oh49520DDVcEmPYZ8oG5idcQjPOpyNnznSecQZMPSI3vN7heiI GWT7nRMSLaGLic4uETnFNdQp8NVLhTy6U1xFOJD6MdVyunOG0KVSdUwg4PT+Iu5Gc0XcNK+/lJtl t7NpnEw46LvewQbG9xOblErA7xJNNrqgAiXx1FbcK/3MZFnbvtj2OZYLfDkBPq7dw9j35nkb//Um mg4dS1tTRyQHGRmo7dm119MAgOodcpdgr3p64tq7P69mr+Zz9wZ6XmxRHmJmojXjkkEnZuotHfS+ Ow= X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:RZA6NrYUehY=;v1OpxmbgBjy/j+qf5gA1nAxkVOP 3GfrSapF/mYfC9mJWFtkeJMmPnOComCfdB/7zLCd9XGiqsenvycrD6M093du0PCqQJflckg4t PF1z8Vn7kuFl4DIOtxX85oeJS+LQzcbxkLQ4zX3zW74lem4nUeesN6bF10ZeUZQ/CJpOGyeLD BjURCi9+fdYQpdi5lzKuiJZemoWEkooTpy/U0WjrssVc2ITWAA7w6GsXQjm0RaA+LNFbR8SRD Qlyl0fvjYrXLv01DuVCKkeleWgz7OTBz5HreSDVpITmVyvPX2h2ENPHKL1F27CvkRoiU/znNw 2fCr1DfgtTSRZl4gXHRwtA1j6SpWOiB1P9Un2bR9erV0MHksclu80HMqPxJblYxB6CQW0AMte /pUb9DCbX6la0WxUneimTYiQI13cjY0qL3dVT6Of4d9dMEGjx/l+eozx9y+ree03lwt1NRWx2 e1PUiKEf1JYqNRRwVuveE2gquikv/sLMo31bxqTMjV9Ut9ER2dxWi2itGn8PO1GId8JJ08mSf jXlkPgTRIjj+/AhXezAr57gdXyR2799pbDibdIAUFkDkvctlHfjjPrq7ffDF3/YUfOXCZTN62 GGzpDeCBsEOcnbh08oAoiCFCitmls50ypdL8rzsMMNVyJsejGPGy3Zx2elKZ5ExxZgrP2mEks SXre6KTZHdhfxZ0vx6V2fecV9HPVtK09ZC4q5i/Jg/zWXijxyX49wEmqSwx7AVaWgjRYjiaEy aRQl9KiCyGMynm1egaYwtAw589SknES2wlNbEeZ3qaOkWqrVI5gXX0+OkWhCEcaWyUX6umGlk wemxggmcj6adEZo2hpRoGJLRTbGBCIGGeFoqc0mDbgK9ucZa7K4GRv2ul6CTm7YDLEu/fHfJG 7HhEiVqG5SQlpzaSJhPRnmAwoXWy6Gu7FloyEqhZnzhfAweJM7zplHIOjLODWXPwDbTGqwvOg YbuUYdMlywn0a/+jlJZrj9wY4Ia+n4cCmZIdSGCYPg/7ejoGXbis3tBtHW/TZsj7nP57S4lg0 INQDSkG6/v1/lr/BsM= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk
Hi all 
I bumped into a weird case that i don't really understand...maybe someone in this list could have a clue
We have 2 Postgres databases configured as master/slave replica (Postgresq 12, RHEL8)
We have applications which write data into the master and applications which reads data from the replica.
A group of applications reads data using libpq: it declares a select statement as cursor and then there is fetch which can retrieve at most 25k rows.
The select statement contains a between clause with T1 and T2. T1 is injected via input parameter but T2=floor(extract (epoch from coalesce(pg_last_xact_replay_timestamp(),now())))-120. It is passed directly like that in the query.
In other words we have something like select * from ZZ where ... and timestamp between $T1 and floor(extract (epoch from coalesce(pg_last_xact_replay_timestamp(),now())))-120;
when this query gets executed, from time to time it returns a truncated number of rows.. less than if i was doing between T1 and T1...
T2 being an integer so either T2<T1 in that case i would get a number of rows of zero or T2>=T1 and I would expect at least #rows greater or equal to the number of rows between T1 and T1,
Note that we are talking about  a total number of rows less than 2000.
Then when i fixed T2, in other words i do a query using between $T1 and $T2 (where T2=floor(extract (epoch from coalesce(pg_last_xact_replay_timestamp(),now())))-120) then there is no issues, number of rows are retrieved correctly.
I also confirmed via metrics collection that the data is there when the query is being performed.
I would appreciate any explanations on this behavior, and hoping i'm clear.
Thanks
Doris