Showing posts with label Database. Show all posts
Showing posts with label Database. Show all posts

Saturday, July 4, 2026

SQLite-Vector: Vector Search in Your Pocket

See All on GenAI    « Previously

Vector Search in Your Pocket

How sqlite-vector brings AI-powered similarity search to any device — no cloud required

Imagine you have a mobile app that needs to find the most similar image, the best product recommendation, or the right document from a pile of data — all while the user is offline. Traditionally, that would mean sending data to the cloud, running a heavy vector database, and waiting for results. But what if your SQLite database could do all of that, right on the device, with just 30 MB of memory and no indexing wait time? That's exactly what sqlite-vector delivers.

SQLite is already the world's most used database — it's in your phone, your browser, your car, and probably your smart fridge. Sqlite-vector is an extension that adds vector search to SQLite. In plain terms, it lets you store "embeddings" (think of them as mathematical fingerprints of images, text, or audio) and then find the closest matches at lightning speed — all using standard SQL.

Why vector search matters (and why you want it offline)

Modern AI models — from ChatGPT to image recognizers — turn everything into vectors: long lists of numbers that represent the "meaning" of a piece of data. When you want to find something similar, you don't search for exact matches; you search for the nearest neighbors in this high-dimensional space.

Think of it like finding the closest cities on a map — except the map has hundreds of dimensions. That's what vector search does, and it powers:

  • Semantic search — finding documents that are conceptually similar to your query
  • Image retrieval — showing visually similar photos
  • Recommendation systems — matching users with products, videos, or music
  • Voice and audio search — identifying sounds or voice queries
  • Anomaly detection — spotting outliers in sensor data

Until now, doing this on a phone or a low-power device was tricky. You'd need a separate vector database like FAISS or Weaviate, which often means running a server, setting up complex indexes, and waiting hours for preprocessing. Sqlite-vector flips that script.

What makes sqlite-vector different?

Most vector search tools are heavyweight. They require special virtual tables, pre‑indexing phases that can take hours, and external servers. Sqlite-vector takes a radically simpler approach:

Works with ordinary SQLite tables — no special schemas
No preindexing — start searching immediately
Zero‑cost updates — add or change vectors on the fly
Offline first — works without internet
Cross‑platform — iOS, Android, Windows, Linux, macOS
Memory‑efficient — just 30 MB RAM by default

It's built in pure C with SIMD acceleration, which means it runs blazingly fast even on mobile CPUs. And because it's just a SQLite extension, you can drop it into any existing project with minimal effort.

The secret sauce: TurboQuant

One of the coolest features is TurboQuant — a clever quantization technique inspired by a Google Research paper. Instead of storing full-precision vectors (which take up a lot of space), TurboQuant compresses them into 2‑bit, 3‑bit, or 4‑bit representations.

This dramatically reduces memory and storage while still keeping search results accurate. For example, on a dataset of 1 million vectors with 768 dimensions each, raw 32‑bit floats would take about 3 GB. TurboQuant 4‑bit shrinks that to just 396 MB — about 13% of the original size. And the search is still 15 times faster than brute force.

Here's a quick look at the performance on a Mac with ARM64 (NEON):

Mode Quantized storage Full scan / query TurboQuant / query Speedup Recall@10
TurboQuant 4‑bit 396 MB 3248 ms 218 ms 14.9× 0.84
TurboQuant 3‑bit 300 MB 1727 ms 188 ms 9.2× 0.74
TurboQuant 2‑bit 204 MB 3265 ms 85 ms 38.3× 0.48

The 4‑bit mode is a great starting point — it gives a solid balance of speed, memory, and accuracy. For really tight edge budgets, 2‑bit can be a lifesaver, though you'll want to test it with your own data.

Getting started (it's really this simple)

Sqlite-vector is available as a pre‑built binary for all major platforms — Linux, macOS, Windows, Android, and iOS. You can also load it as a WASM module for browsers.

Here's the basic flow in SQL:

-- 1. Load the extension
.load ./vector

-- 2. Create a regular table (no virtual tables needed!)
CREATE TABLE images (
    id INTEGER PRIMARY KEY,
    embedding BLOB,   -- store vectors as binary blobs
    label TEXT
);

-- 3. Insert a vector (as a blob or JSON array)
INSERT INTO images (embedding, label)
VALUES (vector_as_f32('[0.3, 1.0, 0.9, 3.2, ...]'), 'cat');

-- 4. Initialize the vector column
SELECT vector_init('images', 'embedding', 'type=FLOAT32,dimension=384');

-- 5. Quantize for blazing-fast search (TurboQuant 4‑bit)
SELECT vector_quantize('images', 'embedding', 'qtype=TURBO,qbits=4');

-- 6. Search for the top 20 nearest neighbors
SELECT e.id, v.distance
FROM images AS e
JOIN vector_quantize_scan('images', 'embedding', ?, 20) AS v
ON e.id = v.rowid;

That's it. No external servers, no complex indexing, no waiting. Your vector search is ready to go.

💡 Pro tip: You can also use vector_quantize_preload() to load the quantized data into memory for a 4‑5× speedup — perfect for interactive apps.

Where does it shine?

Sqlite-vector is built for Edge AI — scenarios where you need intelligence on the device, not in the cloud.

  • Mobile apps that do on‑device image search, face recognition, or voice commands
  • Privacy‑first applications where data never leaves the user's device
  • Offline‑first tools like note‑taking apps with semantic search
  • Embedded systems in robots, drones, or IoT devices

Because it's a SQLite extension, you also get all the benefits of a full relational database — transactions, joins, filters, and ACID guarantees — combined with vector search.

The bigger picture

Sqlite-vector is part of a larger ecosystem from SQLite AI that's turning SQLite into a complete runtime for intelligent, distributed data. There's also sqlite‑sync for offline‑first sync, sqlite‑ai for on‑device LLM inference, and sqlite‑agent for autonomous AI agents — all living inside your SQLite database.

If you don't want to manage it yourself, SQLite Cloud offers a hosted version with sync, auth, edge functions, and a free tier that gives you 512 MB and 20 connections — no credit card required.

Wrapping up

Sqlite-vector is a game‑changer for anyone building AI‑powered applications that need to work offline, on mobile, or at the edge. It's fast, tiny, and dead simple to use. You don't need to learn a new database or wrestle with complex indexing — just SELECT your way to similar items.

Whether you're building a photo app, a recommendation engine, or a privacy‑first search tool, sqlite‑vector gives you superpowers right inside your SQLite database. And with TurboQuant, you get enterprise‑grade performance on devices that fit in your pocket.

Ready to try it? Head over to the GitHub repository, grab the binary for your platform, and start searching in minutes. The era of on‑device AI is here — and it speaks SQL.

Resources: GitHub · Docs · SQLite AI · Releases

All performance numbers and benchmarks are from the project's official documentation and were measured on macOS ARM64 with the NEON backend. Your mileage may vary depending on hardware and data.

See All on GenAI    « Previously
Tags: Generative AI,Database

Saturday, June 13, 2026

Snowflake (NoSQL Database) Books (Jun 2026)


Download Books    Download Report    Other Technology Book Lists

1:
Build Pipelines for AI: An Essential Guide to Smarter Data Engineering
By: 
Year Published: 2024

2:
Building the Interoperable Lakehouse: Data Strategies for AI Leaders
By: 
Year Published: 2024

3:
Bulk loading from Amazon S3 using COPY
By: Snowflake
Year Published: 2020

4:
Bulk loading from a local file system using COPY
By: Snowflake
Year Published: 2023

5:
Cassandra: The Definitive Guide
By: Unknown
Year Published: 2010

6:
Create users and grant roles
By: Snowflake
Year Published: 2023

7:
Data Modeling with Snowflake: A practical guide to accelerating Snowflake development using universal data modeling techniques
By: Serge Gershkovich
Year Published: 2022

8:
Data Trends 2026: Manufacturing
By: 
Year Published: 

9:
Database Performance at Scale: A Practical Guide
By: Unknown
Year Published: 2023

10:
Getting Started with NoSQL
By: unknown
Year Published: 2013

11:
Getting Started with Snowflake
By: Snowflake
Year Published: 2020

12:
JSON basics
By: Snowflake
Year Published: 

13:
Learning Snowflake SQL and Scripting
By: Alan Beaulieu
Year Published: 2022

14:
Load and query sample data using SQL
By: Snowflake
Year Published: 2024

15:
Load data from cloud storage (Amazon S3)
By: Snowflake
Year Published: 

16:
Load data from cloud storage (Google Cloud Storage)
By: Snowflake
Year Published: 2023

17:
Load data from cloud storage (Microsoft Azure)
By: Snowflake
Year Published: 

18:
Loading JSON data into a relational table
By: Snowflake
Year Published: 

19:
Loading and unloading Parquet data
By: Snowflake
Year Published: 2022

20:
Making Sense of NoSQL
By: unknown
Year Published: 2014

21:
Next Generation Databases: NoSQL and Big Data
By: Guy Harrison
Year Published: 2015

22:
NoSQL Distilled
By: unknown
Year Published: 2012

23:
NoSQL Distilled
By: Pramod Sadalage and Martin Fowler
Year Published: 2012

24:
NoSQL For Dummies
By: unknown
Year Published: 2015

25:
NoSQL and SQL Data Modeling
By: unknown
Year Published: 

26:
NoSQL for Mere Mortals
By: Dan Sullivan
Year Published: 2015

27:
NoSQL the Ruby Way
By: Durran Jordan
Year Published: 2012

28:
NoSQL with MongoDB in 24 Hours
By: Brad Dayley
Year Published: 2015

29:
Seven Databases in Seven Weeks: A Guide to Modern Databases and the NoSQL Movement
By: Unknown
Year Published: 2012

30:
Snowflake - The Complete Masterclass 2023
By: Unknown
Year Published: 2023

31:
Snowflake - The Definitive Guide: Architecting, Designing, and Deploying on the Snowflake Data Cloud
By: Joyce Kay Avila
Year Published: 2022

32:
Snowflake Data Engineering
By: Maja Ferle
Year Published: 2021

33:
Snowflake Essentials
By: Frank Bell
Year Published: 2021

34:
Snowflake Intelligence for CFOs
By: 
Year Published: 

35:
Snowflake PDF
By: Tom Coffing and Dave Cook
Year Published: 2016

36:
Snowflake Security: Securing Your Snowflake Data Cloud
By: Ben Herzberg and Yoav Cohen
Year Published: 2023

37:
Snowflake and SAP: Powering Enterprise AI with Unified Data and Context
By: 
Year Published: 2024

38:
Snowflake in 20 Minutes
By: Snowflake
Year Published: Unknown

39:
Snowflake the Definitive Guide
By: O'Reilly
Year Published: 2022

40:
The Essential Guide to Transactional, Analytical and Hybrid Data
By: 
Year Published: 2016

41:
The Snowflake Dummies Guide Series
By: Snowflake Inc.
Year Published: 

42:
Tuning the Snowflake Data Cloud: Optimizing Your Data Platform to Minimize Cost and Maximize Performance
By: Andrew Carruthers
Year Published: 2022


Download Books    Download Report    Other Technology Book Lists

Tags: List of Books,Database,

Sunday, December 21, 2025

Differences in connecting to MySQL from Bash Console and from MySQL Console (At PythonAnywhere)

To See All Articles About Technology: Index of Lessons in Technology
#1 MySQL Console

#2 Bash Console (With Error Message)

Can you tell me what's the issue with my bash

Yes — this is a very common PythonAnywhere confusion, and your setup is actually fine 👍
The issue is not your bash. It’s where MySQL exists on PythonAnywhere.


What you’re seeing (and why)

✅ Image 1 (MySQL console works)

You opened PythonAnywhere’s MySQL console:

pgsql
MySQL: ashishjain1545$default Server version: 8.0.40 Source distribution

✔ This is PythonAnywhere’s managed MySQL server
✔ It lives on PythonAnywhere infrastructure, not inside your bash VM
✔ PythonAnywhere connects you using TCP, not a local socket

So this works ✅


❌ Image 2 (Bash → mysql fails)

In the Bash console you ran:

bash
mysql

And got:

vbnet
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

This happens because:

There is NO local MySQL server running inside your bash container
/var/run/mysqld/mysqld.sock does not exist
❌ PythonAnywhere does not allow you to run MySQL locally

So Bash is doing exactly what it should — it’s just looking in the wrong place.


🔑 Key Concept (Important)

On PythonAnywhere:

ThingExists?
Local MySQL server in bash❌ No
/var/run/mysqld/mysqld.sock❌ No
PythonAnywhere MySQL service✅ Yes
Access via TCP host✅ Yes

✅ Correct way to use MySQL from Bash on PythonAnywhere

You must specify host, user, and database:

bash
mysql \ -u ashishjain1545 \ -h ashishjain1545.mysql.pythonanywhere-services.com \ -p

OR (short form):

bash
mysql -u ashishjain1545 -h ashishjain1545.mysql.pythonanywhere-services.com -p

Then enter your MySQL password (from the Databases tab).


❌ What NOT to do on PythonAnywhere

bash
mysql mysql -u root mysql -u ashish mysql --socket=/var/run/mysqld/mysqld.sock

These only work on machines where MySQL is installed locally, which PythonAnywhere does not allow.


✅ Correct mental model

Think of PythonAnywhere like this:

arduino
[ Your Bash Console ] | | TCP v [ PythonAnywhere MySQL Server ]

Not:

css
[ Bash ][ Local MySQL ]

✅ Summary (TL;DR)

  • ✔ Your MySQL is working

  • ✔ Your bash is working

  • ❌ There is no local MySQL daemon

  • ✅ Always connect using -h <username>.mysql.pythonanywhere-services.com

  • ✅ Or use the MySQL console tab (which you already did)


Query: $ mysql -u ashishjain1545 -h ashishjain1545.mysql.pythonanywhere-services.com -p
Tags: Technology,Database,Cloud,

Tuesday, June 10, 2025

Create a user in MySQL

To See All Articles About Technology: Index of Lessons in Technology

To create a new user in MySQL, follow these steps after logging into the MySQL prompt as root:


✅ Step-by-Step: Create a New User in MySQL

1. Login to MySQL

bash
mysql -u root -p

Enter the root password when prompted.


2. Create the User

sql
CREATE USER 'username'@'localhost' IDENTIFIED BY 'your_password';

✅ Example:

sql
CREATE USER 'ashish'@'localhost' IDENTIFIED BY 'StrongPass@123';

3. Grant Permissions

You can grant full privileges on a database like this:

sql
GRANT ALL PRIVILEGES ON your_database.* TO 'username'@'localhost';

✅ Example:

sql
GRANT ALL PRIVILEGES ON translation_app.* TO 'ashish'@'localhost';

If the database doesn't exist yet:

sql
CREATE DATABASE translation_app;

4. Apply Changes

sql
FLUSH PRIVILEGES;

✅ Verify:

sql
SELECT User, Host FROM mysql.user;

Let me know if you'd like to grant only read access, create the user for remote access, or anything more specific.

Tags: Technology,Database,

Install MySQL Workbench (Community Edition)

To See All Articles About Technology: Index of Lessons in Technology
(base) jain@jain-ThinkPad-T440s:~$ sudo apt install mysql-workbench
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package mysql-workbench

This error means mysql-workbench is not available in your default APT sources, which is common in some Ubuntu derivatives or if the required universe repository isn't enabled.


✅ Solution: Enable universe repository and update

Run the following commands:

bash
sudo add-apt-repository universe sudo apt update sudo apt install mysql-workbench

🛠 If you're still getting errors

It's possible your system is:

  • Not Ubuntu (e.g., Linux Mint, MX Linux, or older version)

  • Or the MySQL Workbench version is not supported in the official repos

In that case, you can install Workbench via .deb package from MySQL’s official site.


✅ Manual Install (if APT fails)

1. Download .deb package from MySQL:

Visit:
https://dev.mysql.com/downloads/workbench/

Select:

  • OS: Ubuntu/Linux DEB

  • Version: Match your Ubuntu version (e.g., 22.04)

2. Install downloaded .deb package:

Assuming the file is named mysql-workbench_*.deb:

bash
sudo dpkg -i mysql-workbench_*.deb sudo apt --fix-broken install

Let me know your Ubuntu version:

bash
lsb_release -a

I can then give you the exact .deb download link or instructions tailored to your distro.

(base) jain@jain-ThinkPad-T440s:~/Downloads$ sudo dpkg -i mysql-workbench-community_8.0.42-1ubuntu24.04_amd64.deb 
Selecting previously unselected package mysql-workbench-community.
(Reading database ... 171412 files and directories currently installed.)
Preparing to unpack mysql-workbench-community_8.0.42-1ubuntu24.04_amd64.deb ...
Unpacking mysql-workbench-community (8.0.42-1ubuntu24.04) ...
dpkg: dependency problems prevent configuration of mysql-workbench-community:
 mysql-workbench-community depends on libatkmm-1.6-1v5 (>= 2.28.4); however:
  Package libatkmm-1.6-1v5 is not installed.
 mysql-workbench-community depends on libglibmm-2.4-1t64 (>= 2.66.7); however:
  Package libglibmm-2.4-1t64 is not installed.
 mysql-workbench-community depends on libgtkmm-3.0-1t64 (>= 3.24.9); however:
  Package libgtkmm-3.0-1t64 is not installed.
 mysql-workbench-community depends on libmysqlclient21 (>= 8.0.11); however:
  Package libmysqlclient21 is not installed.
 mysql-workbench-community depends on libodbc2 (>= 2.3.1); however:
  Package libodbc2 is not installed.
 mysql-workbench-community depends on libproj25 (>= 9.4.0); however:
  Package libproj25 is not installed.
 mysql-workbench-community depends on libsigc++-2.0-0v5 (>= 2.8.0); however:
  Package libsigc++-2.0-0v5 is not installed.
 mysql-workbench-community depends on libzip4t64 (>= 0.10); however:
  Package libzip4t64 is not installed.

dpkg: error processing package mysql-workbench-community (--install):
 dependency problems - leaving unconfigured
Processing triggers for gnome-menus (3.36.0-1.1ubuntu3) ...
Processing triggers for desktop-file-utils (0.27-2build1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for shared-mime-info (2.4-4) ...
Errors were encountered while processing:
 mysql-workbench-community

You're almost there! The error you're seeing is due to missing dependencies required by the .deb package. Fortunately, this is common and can be easily fixed using APT.


✅ Fix MySQL Workbench Installation

After running dpkg, follow up with this command to automatically install all the missing dependencies:

bash
sudo apt --fix-broken install

This will:

  • Fetch and install all the missing packages required

  • Complete the installation of MySQL Workbench


🧪 Then (optional): Verify installation

You can launch MySQL Workbench via:

bash
mysql-workbench

Or search for it in your application menu.


🛠 If --fix-broken doesn’t work

You can manually install all missing dependencies listed:

bash
sudo apt install libatkmm-1.6-1v5 libglibmm-2.4-1t64 libgtkmm-3.0-1t64 libmysqlclient21 libodbc2 libproj25 libsigc++-2.0-0v5 libzip4t64

Then re-run the .deb installer:

bash
sudo dpkg -i mysql-workbench-community_8.0.42-1ubuntu24.04_amd64.deb

Let me know if you'd prefer a lightweight MySQL GUI alternative (e.g., DBeaver, Beekeeper, or HeidiSQL via Wine).

Above debugging fixed my issues:

I ran the below three commands:

sudo dpkg -i mysql-workbench-community_8.0.42-1ubuntu24.04_amd64.deb 
sudo apt install libatkmm-1.6-1v5 libglibmm-2.4-1t64 libgtkmm-3.0-1t64 libmysqlclient21 libodbc2 libproj25 libsigc++-2.0-0v5 libzip4t64
sudo apt --fix-broken install
Tags: Technology,Database,