- The engine is PGlite 0.5.8, a WebAssembly build of PostgreSQL;
SELECT version();reports PostgreSQL 18.3. - It loads from the jsDelivr CDN the first time you press Run (about 17 MB), so the first run takes longer than later ones.
- Sample shop and HR databases are loaded; Reset data restores them, and everything resets when you reload the page.
- Queries run on your device. Nothing you type is sent to CodeWithSQL.
- It is a single-user database in a browser tab, not free PostgreSQL hosting that an application can connect to.
How to run PostgreSQL online here
- Press Run (or Ctrl+Enter, Cmd+Enter on a Mac). The first time, the status line says it is loading PostgreSQL, which is about 17 MB from the jsDelivr CDN; the sample data is created once it has started.
- Use the Examples buttons for Postgres features, or type your own SQL. Several statements can run at once; each one that returns rows gets its own table, showing up to 1,000 rows.
- Download CSV saves the last result. Copy share link puts the query in the URL after
#q=; nothing is stored on a server, and the link fills the editor without running it. - Sample data switches between the shop and HR databases, and Reset data drops your changes.
The shop data has customers(customer_id, name, email, country, signup_date), products(product_id, name, category, price), orders(order_id, customer_id, order_date, status, total) and order_items(order_id, product_id, quantity, unit_price). The HR data has departments(dept_id, name, location) and employees(emp_id, name, dept_id, manager_id, job_title, salary, hire_date).
PostgreSQL queries to try
These use the shop data and syntax that SQLite does not have, so they show the difference from the SQLite-based editor.
SELECT d::date AS day, COUNT(o.order_id) AS orders
FROM generate_series(DATE '2026-02-01', DATE '2026-02-12', INTERVAL '1 day') AS d
LEFT JOIN orders o ON o.order_date = d::date
GROUP BY d
ORDER BY d;SELECT DISTINCT ON (customer_id) customer_id, order_id, order_date, total
FROM orders
ORDER BY customer_id, total DESC;SELECT date_trunc('month', order_date)::date AS month,
COUNT(*) AS orders,
SUM(total) FILTER (WHERE status = 'delivered') AS delivered_revenue
FROM orders
GROUP BY 1
ORDER BY 1;SELECT c.name, string_agg(DISTINCT p.name, ', ' ORDER BY p.name) AS products
FROM customers c
JOIN orders o ON o.customer_id = c.customer_id
JOIN order_items oi ON oi.order_id = o.order_id
JOIN products p ON p.product_id = oi.product_id
GROUP BY c.name
ORDER BY c.name;Limitations compared with a PostgreSQL server
- Single user. The PGlite project states that PGlite is single user and single connection. There are no roles to log in as and no other clients to connect.
- Ephemeral. The playground runs PGlite as an in-memory database, so your tables are lost on reload. PGlite can persist to IndexedDB, but this page does not use that option.
- Version. PGlite 0.5.8 reports PostgreSQL 18.3; the PostgreSQL project's current minor release for version 18 is 18.6. Minor releases contain fixes, not new syntax.
- Extensions. Only the core server is loaded, so extensions such as PostGIS or pgvector are not available here.
- First load. The engine download is large, so use a fast connection the first time.
If you need a PostgreSQL server that an application can reach, see our guide to free PostgreSQL hosting, or install PostgreSQL locally. Choosing between engines? See MySQL vs PostgreSQL and SQLite vs PostgreSQL.
Privacy
PGlite runs inside your browser tab. The engine files come from the jsDelivr CDN, but your queries and results stay on your device and are not sent to CodeWithSQL or to the CDN. A share link contains the query text, so anyone with the link can read it.
For structured practice, try the SQL exercises or the SQL beginner course.
Frequently asked questions
Is this real PostgreSQL?
Yes. PGlite is PostgreSQL compiled to WebAssembly, and the PGlite documentation notes that it does not use a Linux virtual machine. SELECT version(); shows the version it is built from.
Is it free PostgreSQL hosting?
No. The database exists only in your browser tab while the page is open. For a server you can connect to, use a hosted service or install PostgreSQL.
Why is the first run slow?
The browser downloads the PostgreSQL engine (about 17 MB) from the jsDelivr CDN and starts it. Later runs on the same page reuse the running database.
Can I use JSONB?
Yes. Try the JSONB example button, which reads a field with the ->> operator.
Does my data persist?
No. Reloading the page or pressing Reset data starts again from the sample data. Save queries with Copy share link and results with Download CSV.
Sources
- PGlite: What is PGlite
- PGlite on GitHub
- PGlite home page
- PostgreSQL: Versioning policy
- PostgreSQL docs: SELECT
- PostgreSQL docs: Set returning functions
- PostgreSQL docs: JSON types
Checked 8 October 2026.
How we research tool pages: our editorial method. The engines are open-source projects credited on each page.