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 1t86kI-002591-9C for pgsql-general@arkaria.postgresql.org; Mon, 04 Nov 2024 23:44:29 +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 1t86kF-006UKz-Om for pgsql-general@arkaria.postgresql.org; Mon, 04 Nov 2024 23:44:28 +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 1t86kF-006UKq-DU for pgsql-general@lists.postgresql.org; Mon, 04 Nov 2024 23:44:27 +0000 Received: from mail-oi1-x22a.google.com ([2607:f8b0:4864:20::22a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t86kD-000Cxv-D9 for pgsql-general@postgresql.org; Mon, 04 Nov 2024 23:44:26 +0000 Received: by mail-oi1-x22a.google.com with SMTP id 5614622812f47-3e60e57a322so2687467b6e.3 for ; Mon, 04 Nov 2024 15:44:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730763864; x=1731368664; darn=postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=mnx707j5ivUbbjdiU4XE5Rnn9HWteeLiZ0MxGAYKCuc=; b=I1smXHb7XD8kKjKZAuu4idlMpmPH9lrI2BpjqXqC1fxN5G6BkNNtd56471GP5sxd4/ B7d/g8hy9Va8gYkrmd+qX8tsmwB5RJiYAQaAgpKtclPWAdm70AOqkS+WS5Rv9LE/QC7Q /xsBc8meYL/8YXGDljFDN7GaEKgui5GZO3/XMlF1BPripLTYr+iGv5R4JTDEmFe6/HKM A2wE/bRu2eepkJXYSdDHtq/ZXZouqw5SdlmbTG9E898cwTccpslIbTCYtxCoU+OTukir Rd1jnHVN7hcJy1u42viidWcbwk+tS7k4f7LB/LyXax6dFQGRHkatjbfGTBU+15ndb6P6 upVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730763864; x=1731368664; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mnx707j5ivUbbjdiU4XE5Rnn9HWteeLiZ0MxGAYKCuc=; b=Zs2OVGCAzhIXlkHspekk/zeg341W7chXZV7CbjS/2s2M1dEF6kIrFQYI1q+0Gh9eFt pjvssuxM6ncP4TKoKhvqjZCLgoKoMi2CHBfWrNMFIjcnY9XLFsvuKhOCJaAlJsBl+JwE xeHgrbmFGKCQ4qOWZhlLtAFvvsEQinBjWRHG9rORwqV7QKp20ZaB/QmWw9X3LW70g0u9 3UtkAFEse2Ih0+QpLLGc+s8Q8VnVhW6ogt4CSH5WRmzZdTeNsodHKvKh8Q0i1sBNb+CA GBJpBIRgkJzGuvFtM/bsu9g01GEuEpUpTWNZQTV1B4am89Mln6cCzTJG6I9ioojTsoY8 SszA== X-Forwarded-Encrypted: i=1; AJvYcCUyST2MTj5nRa3SyB8AEgOZoLO0tlU6y2q6dCFHDZS/WkVY7FnSsceBTe0tXlzpoZzukYqwwfvFP19NlTPl@postgresql.org X-Gm-Message-State: AOJu0YwpKHUu7lsgbA8CQBCHBPiGX9Ob0XklWjXbRxWQTAaP1swbUEHs nm0uaPSwK0B5FGfuolYsbP08q2Nw+a2tJrFEZwShbfWaVw9CBnswsVXaGS80RzjXFvENfQtQtYz qy8ZX+Pgt0/eJk/unSm76pMlNUm4= X-Google-Smtp-Source: AGHT+IHJL5PR7QcGkS4ixExZ78P+JO/c4d9pnwFHd/Kkb+CEO9XZZRAT99raD7zxMV907TpYnWi1cvUqwVuJiu+Tiy4= X-Received: by 2002:a05:6808:1394:b0:3e5:fd66:c16b with SMTP id 5614622812f47-3e6384c4d98mr33471431b6e.33.1730763864550; Mon, 04 Nov 2024 15:44:24 -0800 (PST) MIME-Version: 1.0 Received: by 2002:ac9:53c8:0:b0:56c:c9af:3ee6 with HTTP; Mon, 4 Nov 2024 15:44:24 -0800 (PST) In-Reply-To: <4e60ede0-86a5-4900-b415-05d68ad75cb1@Spark> References: <3ed0759d-c332-4f96-a147-499a694e9204@Spark> <56c4c567-8422-4944-81d1-2a3c2ac5c8fa@ewie.name> <4e60ede0-86a5-4900-b415-05d68ad75cb1@Spark> From: "David G. Johnston" Date: Mon, 4 Nov 2024 16:44:24 -0700 Message-ID: Subject: Re: nth_value out of more than n values returns null To: Guyren Howe Cc: Erik Wienhold , PG-General Mailing List Content-Type: multipart/alternative; boundary="00000000000056363606261edd40" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000056363606261edd40 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Monday, November 4, 2024, Guyren Howe wrote: > I=E2=80=99m trying to get the id of the 5,000,000th record, so I can join= against > it to get a name. I didn=E2=80=99t fully understand what the docs say the= re. What > am I missing? > So just use =E2=80=9Coffset 5_000_000 limit 1=E2=80=9D. Bringing in a wind= ow function here seems unhelpful. David J. --00000000000056363606261edd40 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Monday, November 4, 2024, Guyren Howe <guyren@gmail.com> wrote:
I=E2=80=99m trying to get the id of the 5,000,000th recor= d, so I can join against it to get a name. I didn=E2=80=99t fully understan= d what the docs say there. What am I missing?

So just use =E2=80=9Coffset 5_000_000 limit 1=E2=80=9D= .=C2=A0 Bringing in a window function here seems unhelpful.

<= /div>
David J.

--00000000000056363606261edd40--