Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

171
Visualizações
Reduce storage space needed in Nodejs/Expressjs/Feathersjs for the user ID

I am working on my first nodejs based project using Feathersjs as a backend and Vue as frontend. When I look in the database then the user ID is a character string looking something like this: "IXS1rCoGogkdOOss".

This seems like it will use more storage space than needed, when a integer user id would suffice.

Can the storage space requirement be reduced somehow?

Perhaps by having the user ID stored as an integer in the database instead of a text string?

I have tried to look through the code but I can not find where the user ID assignment occurs. I am new to both javascipt and node.js and I just can't get my head around this. Searching this site and googling also turned up nothing.

And the reason why it seems like a good idea to reduce the storage size of the user ID is that this will be a multi tenant SaaS with less than 10k users but close to a billion rows containing the user ID.

Thanks for the help!

Edit

I will be using Postgres in production, but have been using NeDB to try things out initially.

The tables with many rows in them consists of 3 int values plus the primary key (which is a int + user ID).

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

This depends entirely on the database you are using. MongoDB, Mongoose use MongoDB ObjectIds and NeDB uses a similar value. For those databases it is not trivial to change the primary id to something else.

An SQL database - which can be used through the Sequelize or KnexJS adapters - usually uses integers as the primary key.

In the grand scheme of things if your database entries consist of anything more than a single other value, the number of characters in the id property does not really matter that much when it comes to actual size though.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda