DEV Community

Pacharapol Withayasakpunt
Pacharapol Withayasakpunt

Posted on


What are UNIQUE index limitations?

MongoDB will throw an error if string indices are being too large.

For SQLite, you can indeed create a unique index on DESCRIPTION, or VARCHAR(VERY_LONG) fields, and probably not throw an error; but are you really willing to accept the consequence?

Even for non-unique indices, probably not all indices helps querying performance that much?

Now that I looked it up, I don't even understand most of the terms.

  • Bitmap index
  • Dense index
  • Sparse index
  • Reverse index
  • Primary index
  • Secondary index

Even for MongoDB and nedb, there are choices of Unique Indices, whether sparse or not.

Now, I am curious on how to design a strongly typed database, with good querying performance, especially if flat and involves minimal joins?

  • About being well-typed, maybe Nitrite is a good one?
  • Well-defined schema can potentially help with typing, but how? Definitely not SQLite, though.
    • I like to work with Node.js, so TypeScript? What about the popular Golang?
    • Does well-defined schema help with performance?

Top comments (0)

An Animated Guide to Node.js Event Loop

Node.js doesn’t stop from running other operations because of Libuv, a C++ library responsible for the event loop and asynchronously handling tasks such as network requests, DNS resolution, file system operations, data encryption, etc.

What happens under the hood when Node.js works on tasks such as database queries? We will explore it by following this piece of code step by step.