Example Scheme for Transactions

Hi, I’m making a scheme for financal transaction. When a customer buy/sell a product, I want to write as a metric. What kind of scheme should I make/create?
Example; (Price and amount is not stable. Customers will decide it.)

tags:
product-id
type (SELL, BUY, AUCTION)
fields:
customer_id (UUID)
amount
price

@Duck, this is definitely a reasonable schema design. If you’re going to have a limited number of customers, it wouldn’t be a bad thing to store the customer_id as a tag, but this would have scalability limits. If you’re looking to grow into 1000s of users, definitely store customer_id as a field.

1 Like

@scott Thans for the information, it really helped me out! I’m planning to have more than a million user. Even over 100 million user, is it problem to store “customer_id” as a field?

Not at all. With that many users, you definitely should store customer_id as a field. It will affect how you query data associated with customers, but nothing crazy. For example, if you’re using Flux, you’ll need to pivot() the data to query the price by customer_id.

1 Like