How to just get the last in a recursive query

From: Shaozhong SHI <shishaozhong(at)gmail(dot)com>
To: pgsql-sql <pgsql-sql(at)lists(dot)postgresql(dot)org>
Subject: How to just get the last in a recursive query
Date: 2022-04-04 22:14:22
Message-ID: CA+i5Jwbh6Yy-zW3AX3WLCUJANky9w8HtVo99NPxMAc9APY0zhw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

---------- Forwarded message ---------
From: Shaozhong SHI <shishaozhong(at)gmail(dot)com>
Date: Mon, 4 Apr 2022 at 23:13
Subject: How to just get the last in a recursive query
To: PostGIS Users Discussion <postgis-users(at)lists(dot)osgeo(dot)org>

In this example, Network Walking in PostGIS · Paul Ramsey
(cleverelephant.ca)
<http://blog.cleverelephant.ca/2010/07/network-walking-in-postgis.html>

3 rows got returns as follows:

id
---
6
3
1

How to just get the last (namely, 1) in the most efficient way?

Regards, David

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rob Sargent 2022-04-04 22:16:02 Re: How to just get the last in a recursive query
Previous Message Steve Midgley 2022-04-02 16:38:41 Re: How long does iteration over 4-5 million rows usually take?