· 1 min read

Naming Convention for Indexes [Quick Read]

Create a clean descriptive index name

Create a clean descriptive index name

I learned this naming convention from Redux Documentation and Web Dev Cody on YouTube.

You can use this convention for

  • Any database index
  • Any time you want to create a map for quick retrieval

“By” Convention


In Database

Suppose you have table movies and two MongoDB index

{"movieId": 1}
{"movieId": 1, "country": 1, "releaseYear":-1}

Rather than having a naming convention like


Have a descriptive naming convention that starts with


You can use the same thing in SQL. Just use snake case instead of camel case.


In Redux

The same convention can be used to create custom indexes in things like Redux.

movies: {
  byId: {




    "M-1:india:2024": { // Example






I’ll explain how to create custom indexes in Redux in a later blog post [TODO].

In Code

Within code, since a map is just an index,

Map<String, Movie> byMovieId = ...;
Map<String, Movie> byMovieIdAndCountryAndReleaseYear = ...;

But for code, this may be too much.

If you think about it, this is very similar to the JPA naming convention.

What naming convention do you use for creating indexes?

Back to Blog