e-commerce application database type

what database type would you choose to program an e-commerce application(like Amazon)?
relational database or NoSQL database or both? and why?

Depending on how you design it you can use either, see dynamodb acid docs, or scylladb lwt docs on how it could work.

Personally I stay away from single-writer databases when possible. Amazon does use both dynamo and Aurora postgres to power their store.

There is a lot more to consider than just the db though, and the db choice is largely a factor of those other decisions.

Personally I either go with ScyllaDB or CockroachDB depending on requirements. DynamoDB is a somewhat distant third choice.

Easiest id always rdbms.
For cloud like aws dynamodb cost is lower but your code is now tied to dynamodb and aws .

Data modeling is different in nosql..access is different.

Easiest is rdbms if you have low volume and no experience in nosql

I’d propose a different aspect. When you said “e-commerce app like Amazon”, my thinking is about the user experience. When I go to Amazon, I type something in the search field and I get a ton of various results.

I think this would be the more important aspect to consider, which I would use something like ElasticSearch.

You can power it on the backend with whatever database you want. Mongodb would work too.

Mongodb is great for this. Just don’t expect to join everything like with sql (you can, but it is not nearly as performant). It’s a bit of a paradigm shift, but being able to persist data structures in a database is awesome.

With something like Amazon, the site is built out of microservices, managed by dozens of different teams. Each service might be backed by one or more types of databases. For example, search might be backed by elasticsearch, comments by DynamoDB, payments by a relational database, etc. The key is to pick the right database for the problem it’s solving. This takes years of experience to do well and is a lucrative skill in the job market.

One key term to learn, if you’re looking for where to start, is ACID. Systems that are tracking payments and orders should have ACID properties. That is atomicy, consistency, isolation, and durability. This is important so that orders don’t get lost or changed if there’s a glitch during processing.

Amazon doesnt use 1 single database. They use a Range of databases for different usecases. You need to find out what you want to build and get the tools that fits your needs