> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

> Reference material for GENERATE_SERIES function

# GENERATE_SERIES

Generates a single rowset of values from `start` to `stop`, with a step size of `step`. `GENERATE_SERIES` is a table-valued function.

## Syntax

```sql theme={"theme":{"light":"css-variables","dark":"css-variables"}}
GENERATE_SERIES ( <start>, <stop> [, <step> ] )
```

## Parameters

| Parameter | Description                                                                                                       | Supported input types |
| :-------- | :---------------------------------------------------------------------------------------------------------------- | :-------------------- |
| `<start>` | The first value in the interval.                                                                                  | `BIGINT`, `INTEGER`   |
| `<stop>`  | The last value in the interval. <br />The series stops once the last generated step value exceeds the stop value. | `BIGINT`, `INTEGER`   |
| `<step>`  | Optional literal integer value to set step. If not included, the default step is 1.                               | `BIGINT`, `INTEGER`   |

## Return Type

Setof `INTEGER` if all operands are of type `INTEGER`, otherwise setof `BIGINT`.

## Example

<div className="query-window">
  ```
  SELECT n, DATE_ADD('DAY', n, '2023-02-02') result
  FROM GENERATE_SERIES(1, 10, 2) s(n);
  ```

  | n <span>int</span> | result <span>timestamp</span> |
  | :----------------- | :---------------------------- |
  | 1                  | 2023-02-03 00:00:00           |
  | 3                  | 2023-02-05 00:00:00           |
  | 5                  | 2023-02-07 00:00:00           |
  | 7                  | 2023-02-09 00:00:00           |
  | 9                  | 2023-02-11 00:00:00           |

  <p><span>Rows: 5</span><span>Execution time: 5.42ms</span></p>
</div>
