---
layout: post
title: "Announcing Auto-increment support: Built-in numeric sequencing for your rows"
description: Get reliable, sequential ordering across your tables with fast, indexed auto-increment IDs.
date: 2025-07-15
lastUpdated: 2026-06-29
cover: /images/blog/announcing-auto-increment-support/cover.avif
timeToRead: 5
author: jake-barnby
category: announcement
featured: false
faqs:
  - question: "What is the `$sequence` field on Appwrite rows?"
    answer: "`$sequence` is a numeric field that Appwrite automatically assigns to each row at insertion time. It starts at one for the first row in a table and increases by one with every new insert, giving you a strictly ascending, indexed identifier without writing any counter logic."
  - question: "How is `$sequence` different from `$id`?"
    answer: "`$id` is a string identifier that is either generated as a unique slug (`ID.unique()`) or set by the caller. `$sequence` is a numeric, monotonically increasing counter managed by Appwrite. Use `$id` for lookups and references and `$sequence` when you need ordering or numeric IDs like invoice numbers."
  - question: "How do I sort rows by insertion order?"
    answer: "Query the table with `Query.orderAsc('$sequence')` (or `orderDesc` for newest-first). The field is fully indexed, so sorting and pagination by `$sequence` perform efficiently even on large tables. The full reference lives in the [order documentation](/docs/products/databases/order#sequence-ordering)."
  - question: "Can I modify the `$sequence` value?"
    answer: "No. `$sequence` is read-only by design. That guarantees the values are consistent, monotonically increasing, and tamper-resistant, which is what makes it suitable for audit logs, invoice numbers, and other use cases that require stable ordering."
  - question: "When should I use timestamps instead of `$sequence`?"
    answer: "Use `$createdAt` when you need wall-clock ordering and are comfortable with millisecond resolution. Use `$sequence` when you need a strict numeric identifier or guaranteed insertion order, since two rows created in the same millisecond will have distinct sequence numbers but identical timestamps."
  - question: "Is auto-increment available on self-hosted Appwrite?"
    answer: "Yes. Auto-increment support is available on both Appwrite Cloud and self-hosted installations of the supported version. Existing tables automatically expose `$sequence` for newly inserted rows."
---

Managing ordered data can often be complex and error-prone, especially when it requires manual counters or timestamp-based sorting, which can introduce inconsistencies and unpredictability.

To tackle this issue, we're introducing **Auto-increment support.**

This new feature automatically handles a `$sequence` column within your rows, incrementing reliably with each new insertion. This ensures your data remains ordered and clear without additional manual overhead.

# Automatic, predictable ordering

Previously, maintaining consistent insertion order and generating numeric identifiers required either manual increments, complex logic, or dependence on timestamps, which weren't always accurate or reliable. Appwrite’s new Auto-increment support feature solves these issues seamlessly, providing a built-in numeric identifier that increases predictably with every new row added.

Whether you're creating paginated data sets, managing invoice numbers, logging activities, or building real-time feeds, Appwrite's Auto-increment support feature offers effortless numeric sequencing. This means less manual work, fewer bugs, and significantly improved reliability.

# Tailored for backend systems

Auto-increment support is engineered explicitly for backend tasks that require consistent, deterministic identifiers such as sorting, pagination, and specialized sequencing. It's particularly suited to applications demanding precision, such as fintech solutions, logistics and shipping systems, invoicing and billing platforms, and comprehensive reporting and analytics tools.

Integrating Auto-increment support into your Appwrite Databases makes your backend development simpler and more intuitive.

# Key advantages at a glance:

- **Automatically managed**: No need to write custom logic or manually increment counters.
- **Strictly increasing**: Each new entry receives a reliably sequential numeric identifier.
- **Fully indexed**: Optimized for performance, allowing fast sorting and efficient querying.
- **Read-only protection**: Safeguards against accidental modifications or tampering, preserving data integrity.

# How it works

For numeric ordering based on insertion order, you can use the `$sequence` field, which Appwrite automatically adds to all rows. This field increments with each new insert.

```client-web
import { Client, TablesDB, Query } from "appwrite";

const client = new Client()
    .setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
    .setProject('<PROJECT_ID>');

const tablesDB = new TablesDB(client);

tablesDB.listRows({
    databaseId: '<DATABASE_ID>',
    tableId: '<TABLE_ID>',
    queries: [
        Query.orderAsc('$sequence'),
    ]
});

```
[Auto-increment support](/docs/products/databases/order#sequence-ordering) is available on both Appwrite Cloud and self-hosted installations and can smoothly integrate into your existing workflows.

# More resources

- [Read the documentation to get started](/docs/products/databases/order)
- [Explore best practices for database pagination](/blog/post/best-pagination-technique)
- [Secure sensitive database fields with encrypted columns](/blog/post/encrypted-attributes-for-sensitive-fields)
