NEW

SurrealDB 4 is here, introducing SurrealDB Earth and SurrealDS!

Learn more
Course content preview

13: Viewing the database as a whole

Now that we have some data in the database, let's see what it looks like as a whole. The INFO FOR DB command will do this.

INFO FOR DB;


The output shows three schemaless tables. These are automatically created every time you use a CREATE statement for a table that doesn't exist yet. If you want to disable this behaviour, you can start SurrealDB in strict mode. In strict mode, you need to manually define anything before you can use it.

All of the statements inside the INFO FOR DB output are followed by a PERMISSIONS NONE clause, meaning that they can't be accessed by record users - users that aren't core database users.

But inside the Sandbox we are logged in as a root user, so PERMISSIONS NONE doesn't affect us.

Output
{
  accesses: {},
  analyzers: {},
  configs: {},
  functions: {},
  models: {},
  params: {},
  tables: {
    place: 'DEFINE TABLE place TYPE ANY SCHEMALESS PERMISSIONS NONE',
    some_record: 'DEFINE TABLE some_record TYPE ANY SCHEMALESS PERMISSIONS NONE',
    town: 'DEFINE TABLE town TYPE ANY SCHEMALESS PERMISSIONS NONE'
  },
  users: {}
}


One of the tables is called some_record, which we created back on page 6 for a simple demonstration. While we deleted all of its records, the DEFINE TABLE statement to create it in the first place wasn't touched, leaving our database with a DEFINE TABLE some_record that we never used again.

Since we won't be needing it, let's remove it with a REMOVE statement. Since the statement to create it was DEFINE TABLE some_record..., it can be removed with REMOVE TABLE some_record.

REMOVE TABLE some_record;


Output
NONE


The output is NONE, showing that the statement succeeded and returned nothing. If you try to run the same REMOVE statement again, you'll see an error instead.

Output
"The table 'some_record' does not exist"


The statements REMOVE DATABASE or REMOVE NAMESPACE or REMOVE INDEX often require removing quite a bit of underlying data. When you execute one of these statements it will return immediately, after which physical deletion of the actual data takes place in the background.

THE PLATFORM

Everything an application and its agents know. Five surfaces, one engine.

IN PRODUCTION

Trusted at scale. Samsung, Nvidia, Verizon, Tencent, and Walmart run on SurrealDB.

14,000+

Developers building on SurrealDB Cloud

4M+

Developers building on SurrealDB worldwide

FROM THE TEAMS

SurrealDB gives us a foundation where we can unify semantic search, knowledge graphs, and AI-driven decision making without stitching together multiple systems. Collapsing responsibility into SurrealDB has become our default engineering posture.
Justin Foley

VP of Engineering, Later