2025-02-06 13:40:00
github.com
A small GUI application built in redbean that lets you explore your SQLite databases “page by page” the way SQLite sees them.
SQLite (and most databases) store data in disk-block-sized pages, usually 4KB, which helps make reads and writes as fast as possible.
Normally developers interact with databases on the “schema level” – tables, rows, and SQL. But taking a peek at the “page level” can give you some interesting insights:
- What your indexes actually look like on disk (they’re basically separate little tables).
- How to store things more compactly (and thus make your queries and applications faster).
- Spot problems and inefficiencies you might not see on the schema level.
- Gain an intuition for B-Trees, one of computing’s most important data structures, the foundation of most filesystems and databases.
Thanks to the magic of redbean, cosmopolitan and αcτµαlly pδrταblε εxεcµταblε, it’s just a single 6.5 MB executable that runs natively on Windows, Linux, MacOS, various BSDs, on both ARM64 and x64.
It’s also a zip file that contains the Lua code that runs the app, parses the database binary format, etc.
- Download
sqlite-page-explorer.com
from the releases. - On Unix-likes,
chmod +x
. - Drag a database file to it, or run it on the console:
sqlite-page-explorer.com mySqliteDatabase.db
. The app should open in a browser tab. - When you’re done, hit Ctrl-C twice in the console.
You might get virus warnings – αcτµαlly pδrταblε εxεcµταblεs seem to freak out browsers, operating system virus detection, etc. and generate false positives. I trust jart is not propagating malware here, and some notable projects like llamafile are using these same polyglot binary techniques, but take your usual precautions with anything you download off the internet.
Also if you throw a large database at it (500 MB or more) it will likely be slow to load the top-level view, which reads every page.
To build, you just need to zip
the contents of files/
into the stock redbean-3.0.0-cosmos.com
which I downloaded from https://cosmo.zip/pub/cosmos/bin/ (click “redbean” on the list). You might need zip
from there too if your system doesn’t have it.
Or just run the zipitup.py
python (3.6+) script that’s included.
If you want to hack on it, you can run redbean-3.0.0-cosmos.com -D files
to serve the app from the files
subdirectory, so you don’t have to rebuild the zip on every change.
This was partly an experiment to try out redbean, and also my first time using Lua, so the code is probably klunkier than it could be. It might benefit from a templating system, ala Jinja or bottle.py’s native templates, rather than so many string concatenations and Write() statements. Would be nice to auto-close the console when the last tab closes, and maybe stop at page 10,000 or so for huge databases, unless the user confirms. PR’s welcome!
Keep your files stored safely and securely with the SanDisk 2TB Extreme Portable SSD. With over 69,505 ratings and an impressive 4.6 out of 5 stars, this product has been purchased over 8K+ times in the past month. At only $129.99, this Amazon’s Choice product is a must-have for secure file storage.
Help keep private content private with the included password protection featuring 256-bit AES hardware encryption. Order now for just $129.99 on Amazon!
Help Power Techcratic’s Future – Scan To Support
If Techcratic’s content and insights have helped you, consider giving back by supporting the platform with crypto. Every contribution makes a difference, whether it’s for high-quality content, server maintenance, or future updates. Techcratic is constantly evolving, and your support helps drive that progress.
As a solo operator who wears all the hats, creating content, managing the tech, and running the site, your support allows me to stay focused on delivering valuable resources. Your support keeps everything running smoothly and enables me to continue creating the content you love. I’m deeply grateful for your support, it truly means the world to me! Thank you!
BITCOIN bc1qlszw7elx2qahjwvaryh0tkgg8y68enw30gpvge Scan the QR code with your crypto wallet app |
DOGECOIN D64GwvvYQxFXYyan3oQCrmWfidf6T3JpBA Scan the QR code with your crypto wallet app |
ETHEREUM 0xe9BC980DF3d985730dA827996B43E4A62CCBAA7a Scan the QR code with your crypto wallet app |
Please read the Privacy and Security Disclaimer on how Techcratic handles your support.
Disclaimer: As an Amazon Associate, Techcratic may earn from qualifying purchases.