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 1lRxfJ-0003VX-31 for pgsql-general@arkaria.postgresql.org; Thu, 01 Apr 2021 13:47:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lRxfI-0002JW-0u for pgsql-general@arkaria.postgresql.org; Thu, 01 Apr 2021 13:47:16 +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 1lRxfH-0002HB-MO for pgsql-general@lists.postgresql.org; Thu, 01 Apr 2021 13:47:15 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lRxfF-00062j-56 for pgsql-general@lists.postgresql.org; Thu, 01 Apr 2021 13:47:15 +0000 Received: by mail-pj1-x1035.google.com with SMTP id kk2-20020a17090b4a02b02900c777aa746fso1044921pjb.3 for ; Thu, 01 Apr 2021 06:47:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=02emsEYMv7mEMGnvPDLsYcgrubV5YX+hgcoXveLEvK0=; b=EKh8/m4X1PO7NYDeVwZUtYkqT4JOEtcJ9gim6/tkumf2hlyWLk+ALFHZ7mW0OnZW1v jUeQXfE+oxq7PZG/M4lFWjeg9Z0TItQTYFX2ozyUJLk6Nm3M76wgN2Ndl2iYzwKVdzml evqPyUKEExSOltQQ4WnMYTOQX1Yuz29q8vEqe6/0RlZ+PpIOkESbaN2dCWw9Laz1zGJk 1NHQCmp6+YSLnkxCnrELmUOXGrif/wHb+sCMAkh0Yxd9sGNQTaB1kjc168IQZPRPskgv cyGkGi13nwVD2bO/SNyeU0fyPcpqA5VZ9Wb2Ym7vxNvQAME2Ab4IMHXXpDb339l7udPp Zj8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:mime-version:subject:from:in-reply-to :date:cc:content-transfer-encoding:message-id:references:to; bh=02emsEYMv7mEMGnvPDLsYcgrubV5YX+hgcoXveLEvK0=; b=feoVEi21OfXQp+aF6wEQ2CXzg+rMXOt772zkLw9RbWL6ELVMTB1dHgJACbBHffc198 VuOfxz6Urw63UbPkvXtgVO0yu8odgEYyj6rKidX8mf3/f5//YZJPK0npCvZnVyRLDz+u SqLxUdFxOlZQs4ArHCabIdotEepx+FzFWAryij29PgiYLNWaLM3a5Rbb8JRgUQ2qWy7S z9PVX/BhBRi623Jk2RB0PFNiGdOuF5z+XHi0mkR4nIyfGo6Cs6q/O7FLr/jvEBYbcqKL 6Y6mQva2TLvEAr1qeRyNS4dmgCzEAltPzwj601R58Wgs3CYb+pdvcLY9dsFe2V/NF8rC gHFw== X-Gm-Message-State: AOAM533Cejjce/XZQUZutSBzM0I3UaXesLhL9KXDXJtn/Yfpra8sZUiL zBKVBipYBVX8ujIds7dohhk= X-Google-Smtp-Source: ABdhPJw6wLw1ohAQ/l0KmFQ6zPOXwl1ZpqS2kGmXrkeo4oYEcN3cCALDbQZk3g9A/J/KDYGsglK7aQ== X-Received: by 2002:a17:90b:438a:: with SMTP id in10mr8862918pjb.165.1617284830935; Thu, 01 Apr 2021 06:47:10 -0700 (PDT) Received: from glens-imac.lan (67.230.181.248.16clouds.com. [67.230.181.248]) by smtp.gmail.com with ESMTPSA id g4sm5939726pgu.46.2021.04.01.06.47.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Apr 2021 06:47:10 -0700 (PDT) Sender: Glen Huang Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.7\)) Subject: Re: How to implement expiration in PostgreSQL? From: Glen Huang In-Reply-To: <9f044a4f-e922-09db-2907-3a34e46a4207@minerva.info> Date: Thu, 1 Apr 2021 21:47:06 +0800 Cc: "pgsql-general@lists.postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: <00D3F5FE-4B45-4CDF-9534-62F3D8C72822@gmail.com> References: <3AE654F0-815D-461B-B7D8-A137FC1C6493@gmail.com> <4100B661-0C3F-4F1A-BE37-FF00423D3CA2@gmail.com> <9f044a4f-e922-09db-2907-3a34e46a4207@minerva.info> To: Tim Clarke X-Mailer: Apple Mail (2.3445.9.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Good suggestion, thanks. I ended up running the cron jobs in my app, one for each newly joined = member, to get the smallest granularity possible. > On Apr 1, 2021, at 9:43 PM, Tim Clarke = wrote: >=20 > On 01/04/2021 14:28, Glen Huang wrote: >>> Possibly keep your count of members updated via a trigger? >> But how to evoke the trigger when the count of members should be = updated by a timeout, i.e., the person=E2=80=99s pay is due? >=20 >=20 > I'd run a cron job that triggers a function call which would make the > necessary expiry tests and set the status accordingly. Maybe run the > cron once an hour or once a day depending on the granularity of your = needs? >=20 > Tim Clarke MBCS > IT Director > Direct: +44 (0)1376 504510 | Mobile: +44 (0)7887 563420 >=20 >=20 > Telephone: Witham: +44(0)1376 503500 | London: +44 (0)20 3009 0853 | = Frankfurt: +49 (0)69 7191 6000 | Hong Kong: +852 5803 1687 | Toronto: +1 = 647 503 2848 > Web: https://www.manifest.co.uk/ >=20 >=20 >=20 > Minerva Analytics Ltd - A Solactive Company > 9 Freebournes Court | Newland Street | Witham | Essex | CM8 2BL | = United Kingdom >=20 > ________________________________ >=20 > Copyright: This e-mail may contain confidential or legally privileged = information. If you are not the named addressee you must not use or = disclose such information, instead please report it to = admin@minerva.info > Legal: Minerva Analytics is the trading name of: Minerva Analytics = Ltd: Registered in England Number 11260966 & The Manifest Voting Agency = Ltd: Registered in England Number 2920820 Registered Office at above = address. Please Click Here https://www.manifest.co.uk/legal/ for further = information.