Skip to content

Benchmark overflows #12

@tvenhola

Description

@tvenhola

Benchmark (as published on medium.com) has several issues:

  • int32 overflows: 48th fibonacci number is larger than 2^31
  • plpgsql version uses decimal, which is a different datatype (infinite length and precision numeric) and does not overflow, i.e. benchmark is comparing apples to oranges
  • Apparently no correctness checks were performed for the returned value, allowing the function to be quick by returning incorrect values and not catching errors

Instead of the current plpgsql implementation like this could (should) be used
with recursive r(a, b, c) as ( select 0::int, 1::int, 1::int union all select b, a + b, c+1::int from r where c < 46 ) select a from r where c = 45;

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions