Skip to main content
A database schema defines how the tables and indexes in your database are organized. Using a schema that is appropriate for your workload can result in significant performance improvements. Conversely, using a poorly suited schema can result in significant performance degradation. If you are working with semi-structured data, such as readings from IoT sensors that collect varying measurements, you might need a flexible schema. In this case, you can use JSON and JSONB data types. supports all table objects supported within , including data types, indexes, and triggers. However, when you create a , set the datatype for the time column as timestamptz and not timestamp. For more information, see timestamp best practices. This section explains how to design your schema, how indexing and tablespaces work, and how to use constraint types. It also includes examples to help you create your own schema, and learn how to use JSON and JSONB for semi-structured data. In this section: