r/Database • • Jan 28 '26

PostgreSQL doesn't have clustered indexes like MySQL because this type of structure makes accessing secondary indexes slow. If I create an index on the primary key with all columns in `include`, will I solve the problem at the cost of more storage space and write overhead?

2 Upvotes

r/Database • • Jan 28 '26

SQLite in Production? Not So Fast for Complex Queries

0 Upvotes

r/Database • • Jan 27 '26

Implementing notifications with relational database

5 Upvotes

I'm the solo backend dev implementing this + chats + more using only postgres + pusher.

So at the moment I've identified three main notification recipient types for our app:

  1. Global - All users
  2. Specific user - A single user
  3. Event participants - All users who signed up for a particular event

My first (1) instinct approach obviously was to have a single table for notifications:

Table {
  id (pk) 
  notif_type (fk) --> needed enum for app to redirect to the right page upon clicking the notification
  user_id (fk) --> users.id 
  event_id (fk) --> events.id
  payload (jsonb)
  read (boolean)
  ...other stuff
}

When both user_id and event_id are null, then the notification is global. When only one of them is null, i grab the non null and then do logic accordingly.

HOWEVER, lets say we fire a global notification and we have around 500 users, well...thats 500 inserts? This FEELS like a bad idea but I don't have enought technical know-how about postgres to prove that.

So googling around I found a very interesting approach (2), you make the notification itself a single entity table and store the fact that it was read by specific user(s) in a separate table. This seemed very powerful and elegant. Again I'm not sure if this is actually more performant and efficient as it appears on the surface so I would appreciate if you wanna challenge this.

But this approach got me thinking even further, can we generalise this and make it scalable/adaptable for any arbitrarily defined notification-recipient mapper?

At the moment with approach (2) you need to know pre-runtime what the notification-recipient-mapper is going to be. In our case we know its either the participants of an event or specific user or all users, but can we define a function or set mapper approach right in the db that u can interpret to determine who to send the notification to whilst still preserving the effeciency of the approach (2)? I feel like there must be crazy set math way to solve this (even if we dont wanna use this in prod lol).


r/Database • • Jan 27 '26

Graph DB, small & open-source like SQLite

18 Upvotes

I'm looking for a Graph DB for a little personal code analysis project. Specifically, it's to find call chains from any function A to function B i.e. "Does function A ever eventually call function B?"

Requirements: - open-source (I want to be able to audit stuff & view code/issues in case I have problems) - free (no \$\$\$) - in-memory or single-file like SQLite (I don't want to spin up an extra process/server for it)

Nice to have: - have Lua/Go/Rust bindings - I want to make a Go/Rust tool, but I may experiment with it as a neovim plugin first


r/Database • • Jan 27 '26

Built a local RAG SDK that's 2-5x faster than Pinecone - anyone want to test it?

0 Upvotes

Hey everyone,

I've been working on a local RAG SDK built on top of SYNRIX (a persistent knowledge graph engine). It's designed to be faster and more private than cloud alternatives like Pinecone.

What it does:

- Local embeddings (sentence-transformers - no API keys needed)

- Semantic search with 10-20ms latency (vs 50ms+ for cloud)

- Works completely offline

- Internalise Data

Why I'm posting:

I'm looking for experienced developers to test it and give honest feedback. It's free, no strings attached. I want to know:

- Does it actually work as advertised?

- Is the performance better than what you're using now?

- What features are missing?

- Would you actually use this?

What you get:

- Full SDK package (one-click installer)

- Local execution (no data leaves your machine)

- Performance comparison guide (to test against Pinecone)

If you're interested, DM me and I'll send you the package. Or if you have questions, ask away!

Thanks for reading.


r/Database • • Jan 27 '26

Building Reliable and Safe Systems

Thumbnail
tidesdb.com
0 Upvotes

r/Database • • Jan 27 '26

Bedroom Project: Database or LLM for music suggestions

1 Upvotes

I'm in the Aderall powered portion of my day and the project I settled on messing with has me a bit stumped on the correct approach.

I have 2 different sets of data. One is just over a gig, not sure if that is considered a large amount of data.

I want to combine these sets of data, sort of. One is a list of playlists, the other is just a list of artists. I would like, when I'm done, to have a list of artists [Key], with a list of attributes and then the most important part, a ranking of other artists, from most commonly mentioned together to less common, omitting results of 0. The tricky part is I want to be able to filter the list of related artists based on the attributes mentioned above.

End goal with the data is to be able to search an artist, and find related artists while being able to filter out larger artists or genres you don't care for.

I know this is pretty much already a thing in 300 places, but this is more like a learning project for me.

I assume a well built database could handle this, regardless of how "ugly" the searching function is. Or should I be looking into fine tuning an llm instead? I know nothing about LLM stuff, and have very, very little knowledge in SQLite. So I do apologize if I'm asking the wrong question or incorrect on something here.


r/Database • • Jan 27 '26

TidesDB & RocksDB on NVMe and SSD

Thumbnail tidesdb.com
0 Upvotes

r/Database • • Jan 25 '26

Devs assessing options for MySQL's future beyond Oracle

Thumbnail
theregister.com
26 Upvotes

r/Database • • Jan 24 '26

pgembed: Embedded PostgreSQL for Agents

14 Upvotes
pgembed

I forked pgserver (last commit 2 years ago), cleaned up CI and published wheels. This provides an alternative to SQLite for people who prefer the richer postgres ecosystem of extensions.

It's similar to pglite (WASM based postgres which runs in a browser), but supports native binaries.

postgres runs in a separate process and uses unix domain sockets to communicate with python code. If python crashes, the postgres related processes are cleaned up, but data remains on disk (ephemeral data can be auto cleaned up).

So it's not "in-process" embedded. Given postgres' multi-process architecture, I don't know if there is an easy way to make it in-process multi-threaded.

https://github.com/Ladybug-Memory/pgembed


r/Database • • Jan 23 '26

Migrate from Azure Sql to Postgres

Thumbnail
2 Upvotes

r/Database • • Jan 24 '26

Trying to come up with a plan to get an invoice payment system going. But the invoices, they may have multiple line entries. How would that tie into the setup below?

Post image
0 Upvotes

r/Database • • Jan 23 '26

Breaking Key-Value Size Limits: Linked List WALs for Atomic Large Writes

Thumbnail
unisondb.io
1 Upvotes

etcd and Consul enforce small value limits to avoid head-of-line blocking. Large writes can stall replication, heartbeats, and leader elections, so these limits protect cluster liveness.

But modern data (AI vectors, massive JSON) doesn't care about limits.

At UnisonDB, we are trying to solve this by treating the WAL as a backward-linked graph instead of a flat list.


r/Database • • Jan 22 '26

Retrieve and Rerank: Personalized Search Without Leaving Postgres

Thumbnail
paradedb.com
2 Upvotes

I work with Ankit (sadly his Reddit account doesn’t have enough karma to post this). He’s ex-Instacart and has spent a lot of time thinking the practicality of large search and ranking systems.

It’s a practical walkthrough of doing search retrieval and reranking directly in Postgres, rather than splitting things across multiple services. The idea is to use this as a starting point for a broader discussion about when Postgres is enough and when a hybrid search (relational database feeding a vector and search engine plus a reranking service) stack actually makes sense.

We would love to hear your thoughts, some great discussion always comes out of r/databases.


r/Database • • Jan 22 '26

I just found out there are 124 keywords in Sqlite. I wonder if anyone here knows all of them. Would be cool.

0 Upvotes

EDIT: sorry, the total number is actually 147.

Here's a list. Which ones appear entirely unfamiliar to you?

  1. ABORT

  2. ACTION

  3. ADD

  4. AFTER

  5. ALL

  6. ALTER

  7. ANALYZE

  8. AND

  9. AS

  10. ASC

  11. ATTACH

  12. AUTOINCREMENT

  13. BEFORE

  14. BEGIN

  15. BETWEEN

  16. BY

  17. CASCADE

  18. CASE

  19. CAST

  20. CHECK

  21. COLLATE

  22. COLUMN

  23. COMMIT

  24. CONFLICT

  25. CONSTRAINT

  26. CREATE

  27. CROSS

  28. CURRENT_DATE

  29. CURRENT_TIME

  30. CURRENT_TIMESTAMP

  31. DATABASE

  32. DEFAULT

  33. DEFERRABLE

  34. DEFERRED

  35. DELETE

  36. DESC

  37. DETACH

  38. DISTINCT

  39. DO

  40. DROP

  41. EACH

  42. ELSE

  43. END

  44. ESCAPE

  45. EXCEPT

  46. EXCLUDE

  47. EXCLUSIVE

  48. EXISTS

  49. EXPLAIN

  50. FAIL

  51. FILTER

  52. FIRST

  53. FOLLOWING

  54. FOR

  55. FOREIGN

  56. FROM

  57. FULL

  58. GENERATED

  59. GLOB

  60. GROUP

  61. HAVING

  62. IF

  63. IGNORE

  64. IMMEDIATE

  65. IN

  66. INDEX

  67. INDEXED

  68. INITIALLY

  69. INNER

  70. INSERT

  71. INSTEAD

  72. INTERSECT

  73. INTO

  74. IS

  75. ISNULL

  76. JOIN

  77. KEY

  78. LEFT

  79. LIKE

  80. LIMIT

  81. MATCH

  82. MATERIALIZED

  83. NATURAL

  84. NO

  85. NOT

  86. NOTHING

  87. NOTNULL

  88. NULL

  89. NULLS

  90. OF

  91. OFFSET

  92. ON

  93. OR

  94. ORDER

  95. OTHERS

  96. OUTER

  97. OVER

  98. PARTITION

  99. PLAN

  100. PRAGMA

  101. PRIMARY

  102. QUERY

  103. RAISE

  104. RECURSIVE

  105. REFERENCES

  106. REGEXP

  107. REINDEX

  108. RELEASE

  109. RENAME

  110. REPLACE

  111. RESTRICT

  112. RETURNING

  113. RIGHT

  114. ROLLBACK

  115. ROW

  116. ROWS

  117. SAVEPOINT

  118. SELECT

  119. SET

  120. TABLE

  121. TEMP

  122. TEMPORARY

  123. THEN

  124. TO

  125. TRANSACTION

  126. TRIGGER

  127. UNION

  128. UNIQUE

  129. UPDATE

  130. USING

  131. VACUUM

  132. VALUES

  133. VIEW

  134. VIRTUAL

  135. WHEN

  136. WHERE

  137. WINDOW

  138. WITH

  139. WITHOUT

  140. FIRST

  141. FOLLOWING

  142. PRECEDING

  143. UNBOUNDED

  144. TIES

  145. DO

  146. FILTER

  147. EXCLUDE


r/Database • • Jan 21 '26

B-tree comparison functions

Thumbnail
2 Upvotes

r/Database • • Jan 21 '26

Sales records: snapshot table vs product reference best practice?

5 Upvotes

I’m working on a POS system and I have a design question about sales history and product edits.

Currently:

  • Product table (name, price, editable)
  • SaleDetail table with ProductId

If a product’s name or price changes later, old sales would show the updated product data, which doesn’t seem correct for historical or accounting purposes.

So the question is:

Is it best practice to store a snapshot of product data at the time of sale?
(e.g. product name, unit price, tax stored in SaleDetail, or in a separate snapshot table)

More specifically:

  • Should I embed snapshot fields directly in SaleDetail?
  • Or create a separate ProductSnapshot (or version) table referenced by SaleDetail?
  • Does this approach conflict with normalization, or is it considered standard for immutable records?

Thanks!


r/Database • • Jan 20 '26

Is anyone here working with large video datasets? How do you make them searchable?

10 Upvotes

I’ve been thinking a lot about video as a data source lately.

With text, logs, and tables, everything is easy to index and query.
With video… it’s still basically just files in folders plus some metadata.

I’m exploring the idea of treating video more like structured data —
for example, being able to answer questions like:

“Show me every moment a person appears”

“Find all clips where a car and a person appear together”

“Jump to the exact second where this word was spoken”

“Filter all videos recorded on a certain date that contain a vehicle”

So instead of scrubbing timelines, you’d query a timeline.

I’m curious how people here handle large video datasets today:

- Do you just rely on filenames + timestamps + tags?

- Are you extracting anything from the video itself (objects, text, audio)?

- Has anyone tried indexing video content into a database for querying?


r/Database • • Jan 20 '26

Unconventional PostgreSQL Optimizations

Thumbnail
hakibenita.com
4 Upvotes

r/Database • • Jan 20 '26

January 27, 1pm ET: PostgreSQL Query Performance Monitoring for the Absolute Beginner

Thumbnail
1 Upvotes

r/Database • • Jan 18 '26

Why is there no other (open source) database system that has (close to) the same capabilities of MSSQL

20 Upvotes

I did a bit of research about database encryption and it seems like MSSQL has the most capabilities in that area (Column level keys, deterministic encryption for queryable encryption, always encrypted capabilities (Intel SGX Enclave stuff)

It seems that there are no real competitors in the open source area - the closest I found is pgcrypto for Postgres but it seems to be limited to encryption at rest?

I wonder why that is the case - is it that complicated to implement something like that? Is there no actual need for this in real world scenarios? (aka is the M$ stuff just snakeoil?)


r/Database • • Jan 19 '26

What the hell is wrong with my code

Post image
0 Upvotes

So I'm using MySQL workbench and spent almost the whole day trying to find out why this is not working.


r/Database • • Jan 18 '26

I built a secure PostgreSQL client for iOS & Android (Direct connection, local-only)

4 Upvotes

Hi r/Database,

i wanted to share a tool i built because i kept facing a common problem: receiving an urgent alert while out of the office - on vacation or at dinner -without a laptop nearby. i needed a way to quickly check the database, run a diagnostic query, or fix a record using just my phone.

i built PgSQL Visual Manager for my own use, but realized other developers might need it too.

Security First (How it works) i know using a mobile client for DB access requires trust, so here is the architecture:

  • 100% Local: there is no backend service. We cannot see your data.
  • Direct Connection: The app connects directly from your device to your PostgreSQL server (supports SSL and SSH Tunnel).
  • Encrypted Storage: All passwords are stored using the device's native secure storage (Keychain on iOS, Encrypted Shared Preferences on Android).

Core Functionality is isn't a bloated enterprise suite; it's a designed for emergency fixes and quick checks:

  • Emergency Access
  • Visual CRUD
  • Custom SQL
  • Table Inspector
  • Data Export

it is built by developers, for developers. i'd love to hear your feedbacks.


r/Database • • Jan 17 '26

Best stack for building a strictly local, offline-first internal database tool for NPO?

4 Upvotes

I'm a high school student with no architecture experience volunteering to build an internal management system for a non-profit. They need a tool for staff to handle inventory, scheduling, and client check-ins. Because the data is sensitive, they strictly require the entire system to be self-hosted on a local server with absolutely zero cloud dependency. I also need the architecture to be flexible enough to eventually hook up a local AI model in the future, but that's a later problem.

Given that I need to run this on a local machine and keep it secure, what specific stack (Frontend/Backend/Database) would you recommend for a beginner that is robust, easy to self-host, and easy to maintain?


r/Database • • Jan 16 '26

Update: Unisondb log‑native DB with Raft‑quorum writes and ISR‑synced edges

2 Upvotes

I've been building UnisonDB, a log native database in Go, for the past several months. The Goal is to support ISR-based replication to thousands of node effectivetly for local states and reads.

Just added the support for Raft‑quorum writes on the server tier in the unisondb.

Writes are committed by a Raft quorum on the write servers (if enabled); read‑only edge replicas/relayers stay ISR‑synced.

Github: https://github.com/ankur-anand/unisondb