Skip to the main text

SQLite

Preview a SQLite database from a link

A .db or .sqlite link could be 5 MB or 500 MB, and the question is usually just which tables are in it. Foretaste answers that from the first 256 KB. The rest of the file stays where it is.

chinook.sqlite
0.05% of the file was read
read 256 KB of 524,288,000 bytes
Every table, column and CREATE statement came out of that. Counting the rows is a separate press, because it walks the whole file.

01

What you see

Right-click the link, choose Open with Foretaste, and you get:

  • Every table in the database, listed.
  • Every column, with the type it was declared as.
  • The CREATE statement each table was built from, exactly as SQLite stored it, so you can read the keys and constraints too.
  • Row counts on request. Exact ones, from a button, because getting them means walking every table rather than reading a header.

Views and triggers appear as the SQL that defines them. Reading the rows themselves, a page at a time, and exporting what you are looking at as CSV or JSON, is a Pro feature. The schema is not.

02

Why the first 256 KB is enough

SQLite keeps its own schema in an ordinary table called sqlite_master, and writes it at the start of the file. One row per table, index, view and trigger, each holding the SQL it was created from.

So the whole structure of a database sits in its first few pages, and one HTTP range request for the first 256 KB brings back all of it. For a 500 MB database that is 0.05% of the file, and it costs the same whether the database is 5 MB or 5 GB.

It is the same trick as listing a ZIP from its index, pointed at the other end of the file.

03

Where it stops

Nothing can be queried. Foretaste ships no SQL engine, so there is no filtering, no joining and no SELECT. If that is what you need, download the file and open it in DB Browser for SQLite or the sqlite3 command line.

Counting rows costs the file. An exact count means visiting every row, so on a large database it can mean fetching a lot of it. That is why it is a button you press rather than something that happens while you are reading.

Views and triggers are text. You see the SQL that defines them. Nothing runs it.

04

Against the alternatives

The web-based SQLite viewers want the file uploaded, or opened from your own disk, which means downloading the whole database before you can find out whether it was the right one. A desktop tool wants the same download and an install as well.

Foretaste reads it from the link. That is worth having when the file is large, when it is one of several on a page and you are trying to work out which, or when it is a database you would rather not hand to a website you have never heard of.

When you do need to work on the data, download it: the Save button is on every screen, needs no site permission, and is free.

Nothing is uploaded

The range request goes to the website hosting the database, the same request your browser would make if you clicked the link. Foretaste has no server for a file to pass through, and nothing about what you opened is recorded anywhere.

Exactly what Foretaste can and cannot see.

The questions people ask

Can I view a SQLite database in my browser without downloading it?

Yes. Foretaste reads a SQLite schema out of the first 256 KB of the file: every table, its columns and its CREATE statement, without downloading the rest. Install the extension, right-click a .db or .sqlite link and choose Open with Foretaste.

How does Foretaste read a SQLite database without downloading it?

SQLite writes its schema into a table called sqlite_master on the first pages of the file. Foretaste fetches just those pages with an HTTP range request, typically 256 KB or less, and reads the table definitions out of them. The rest of the database stays on the server.

Can Foretaste run SQL queries on a SQLite database?

No. Foretaste shows the schema and can count rows on request, but it ships no SQL engine, so nothing can be queried. For that, download the file and use a desktop tool such as DB Browser for SQLite.