Skip to content

Instantly share code, notes, and snippets.

@tsh-code
Created March 26, 2019 11:48
Show Gist options
  • Save tsh-code/3dc6835a1c2de1c47503eb2800692063 to your computer and use it in GitHub Desktop.
Save tsh-code/3dc6835a1c2de1c47503eb2800692063 to your computer and use it in GitHub Desktop.
WITH RECURSIVE fib(prevValue, value) AS (
SELECT 0::float8, 1::float8
UNION ALL
SELECT value::float8, prevValue::float8 + value::float8 FROM fib
)
SELECT value FROM fib LIMIT 1 OFFSET 999;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment