Indexing and Performance

Create, inspect, and drop indexes in the Console. Use SDK query controls to select and paginate application data.

Overview

The Oracle Backend with Supabase APIs SDK supports filters, projections, ordering, and pagination to control which rows and columns a query returns.

Database indexes provide additional access paths for queries. The database optimizer decides whether to use an index. Indexes also require storage and maintenance during writes.

The following example uses a relational project with an existing TODOS table and permission to create and drop its indexes.

Creating Indexes

To create an index in the Console:

  1. Open your relational project and select Database.
  2. In Table Editor, select Indexes, and click Create Index.
  3. Enter TODOS_COMPLETED_IDX in Index name and select TODOS in Table name.
  4. Under Columns, select COMPLETED for Column name. Keep B-tree as Index type and Ascending as Sort order.
  5. Review SQL Preview to confirm the table and column.

    Description of the illustration indexing-create-index.png

  6. Click Create. The index appears in the Indexes list.

For SQL syntax and privileges, see CREATE INDEX.

Managing Indexes

To inspect an index:

  1. In Indexes, enter its name in Search indexes and press Enter.
  2. Check the Name, Table, Index type, and Columns values in the result.

    Description of the illustration indexing-index-list.png

  3. Open the index’s Actions menu and select Edit Index to inspect its configuration and SQL Preview. Click Cancel after reviewing the definition.

To drop an index that is no longer needed:

  1. Open its Actions menu and select Drop Index.
  2. Confirm the index name in the dialog, then click Drop index.

    Description of the illustration indexing-drop-index.png

The index is removed from the list.

For SQL metadata and removal syntax, see USER_INDEXES and DROP INDEX.

Query Performance

Use select() to request only the required columns. Use limit(count) to limit the maximum number of returned rows and range(from, to) to return an inclusive result range.

With an initialized relational client and read access to TODOS, this example orders rows by identifier, skips the first 20 rows, and returns up to 20 rows:

const { data, error } = await client
  .from("todos")
  .select("*")
  .order("id")
  .range(20, 39);