Skip to content
Back

"Index length is longer than the maximum: 768". Unable to create index.

  • 0
  • General
  • Cloud
ankush
5 Jun, 2025, 12:45

In one my database, my attribute for sid seems to no more than 32 characters. I am not sure what 768 limit is here. Can't find it in the docs either.

I need it to optimize fetch performance for my query here:

TypeScript
  const { documents } = await databases.listDocuments(
    DB_ID,
    SESSIONS_COLLECTION,
    [
      Query.equal('sid', [sid]),
      Query.orderDesc('$updatedAt'),
      Query.limit(1)
    ]
  );

Could someone help me please?

This is related to an issue where my project was blocked a couple of days ago - https://discord.com/channels/564160730845151244/1379470042198179940

TL;DR
The developer is encountering an error when trying to create an index due to a length limitation of 768 characters. They are unsure of the cause as their attribute `sid` is within the 32-character limit. They need assistance to optimize the fetch performance for their query. **Solution:** - The issue is likely related to the length of all indexed fields combined. Consider shortening field names or creating a composite index that includes `sid`. - Review the index configuration and database limits to ensure compliance.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more