Sobes.tech
Junior — Middle

What type of index structures are usually automatically formed when creating a database?

sobes.tech AI

Answer from AI

When creating a database, a B-tree index is usually automatically generated for the primary key of the table.

A B-tree is a balanced index structure that provides efficient search, insertion, and deletion of data. Such an index speeds up query operations by key and is supported by most relational DBMSs by default.

For example, when creating a table with a primary key:

CREATE TABLE users (
  id INT PRIMARY KEY,
  name VARCHAR(100)
);

The DBMS will automatically create a B-tree index on the id column.