ScyllaDB University LIVE, FREE Virtual Training Event | March 21
Register for Free
ScyllaDB Documentation Logo Documentation
  • Deployments
    • Cloud
    • Server
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Install
Ask AI
ScyllaDB Docs ScyllaDB Documentation Get Started with ScyllaDB Data Modeling Schema Design

Schema Design¶

When adopting a query-first data model, the same constraints need to be applied to the schema design. While schema design can evolve to meet your changing application needs, there are certain choices you will need to make to get the most value out of ScyllaDB. This further reinforces the concept of adopting a query-first data model.

Data Types

Selecting the appropriate data type for your columns is critical to your application semantics in your data model. You will need to consider factors such as data size, indexing, and sorting.

Let’s say you’re designing a table to store information about e-commerce products, and one of the attributes you want to capture is the product’s price. The choice of data type for the “price” column is crucial for efficient storage and query performance.

CREATE TABLE my_keyspace.products (
  seller_id uuid,
  product_id uuid,
  product_name text,
  price decimal,
  description text,
  PRIMARY KEY (seller_id, price, product_id)
);

In this example, for the price` column, we’ve chosen the decimal data type. This data type is suitable for storing precise numerical values, such as prices, as it preserves decimal precision. Choosing decimal over other numeric data types like float or double is essential when dealing with financial data to avoid issues with rounding errors.

You can efficiently index and query prices using the decimal data type, ensuring fast and precise searches for products within specific price ranges partitioned by seller_id. When you need to sort products by price, the decimal data type maintains the correct order, even for values with different decimal precision.

Was this page helpful?

PREVIOUS
Query Design
NEXT
Data Modeling Best Practices
  • Create an issue
  • Edit this page
ScyllaDB Documentation
  • Get Started with ScyllaDB
    • Why ScyllaDB?
    • Develop with ScyllaDB
      • Run ScyllaDB
      • Install a Driver
      • Connect an Application
      • Tutorials and Example Projects
    • Query Data
      • CQL
      • Schema
      • Inserting Data
      • Reading Data
      • Updating Data
      • Deleting Data
    • Data Modeling
      • Query Design
      • Schema Design
      • Data Modeling Best Practices
    • Learn to Use ScyllaDB
  • Versioning and Support Policy
    • ScyllaDB Version Support
    • Driver Support Policy
Docs Tutorials University Contact Us About Us
© 2025, ScyllaDB. All rights reserved. | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 16 Sep 2025.
Powered by Sphinx 7.4.7 & ScyllaDB Theme 1.8.8
Ask AI