Data Destinations
In this lesson, we’ll explore the process of choosing data destinations — where to store processed data after the ETL process is complete. Selecting the right destination is essential for ensuring that data is stored efficiently, accessed quickly, and supports the organization’s analytical and reporting needs. Each type of storage solution has its strengths and is suited for specific use cases, data formats, and query patterns.
Types of data destinations
Data destinations are the final storage points where data resides after extraction and transformation. These destinations need to align with the organization’s use cases, performance needs, and budget constraints. The main types of data destinations include data lakes, data warehouses, in-memory databases, and hybrid storage solutions, each serving unique roles in analytics and data processing.
Data Lakes
Data lakes are storage systems that hold large volumes of raw, unstructured, or semi-structured data in its native format. They are commonly used as central repositories for storing a wide range of data, such as batch files from various source systems, clickstream data, logs, or other raw data. For example, daily batch files from operational systems may be dropped into NFS-type file servers and then extracted and stored in a data lake for further analysis and business reporting.
- Pros: Highly scalable, cost-effective for storing large data volumes, supports schema evolution, and integrates well with ETL frameworks (e.g., Apache Spark).
- Cons: Querying large datasets can introduce latency; requires proper partitioning and optimized file formats (e.g., Parquet, Avro) for better performance. Complexity in data governance and metadata management.
- Use cases: Storing historical, unstructured, or semi-structured data for future analysis. Ideal for environments where raw data needs to be accessed occasionally or preprocessed before further analysis.
Typical data lake architecture:
- Raw Data Layer: The raw data layer stores data in its unaltered form, as it was ingested from various sources. This layer allows businesses to preserve the full integrity of the original data for future processing or reprocessing if needed.
- Validated Data Layer: This layer contains data that has undergone initial validation, either through business rules or technical checks. Validated data is ensured to meet specific quality criteria and is ready for further processing.
- Integrated Data Layer: The integrated data layer is where data from various sources is joined, enriched, and transformed into cohesive data assets. This layer supports creating a unified view of the data, making it easier for analysis and reporting.
- Access/Publish Layer: In this layer, data is made available for consumption by business users, reporting tools, or other systems. Data is presented in a form that is optimized for querying, typically through views, materialized views, or business-friendly reports.
Data Warehouses
Data warehouses are optimized for complex analytical queries and are generally structured environments designed to support fast, consistent data retrieval. They work best for structured data and support Business Intelligence (BI) tools.
- Pros: Optimized for fast queries, enforces schemas for data consistency, and supports complex analytics.
- Cons: Can be more expensive compared to data lakes, less flexible for unstructured data, and may require additional preprocessing. Query speed can vary depending on query complexity, as data warehouses often involve multiple tables, aggregations, and calculations, making queries take longer over time.
- Use cases: Storing processed, structured data for reporting, analytics, and BI purposes. Often used by organizations needing low-latency querying for real-time insights.
Data warehouses follow the Schema-on-Write principle, where the schema is defined before data is written to the warehouse, ensuring structured, consistent data. In contrast, data lakes operate on a Schema-on-Read principle, where data is stored in its raw form and schemas are applied at the time of reading, allowing more flexibility for unstructured data.
Columnar Databases
Columnar databases store data by columns rather than rows, which is efficient for analytical workloads and minimizes disk I/O by scanning only relevant columns. They are useful for ad-hoc querying and reporting.
- Pros: Well-suited for analytical queries, allows fast scanning of specific columns, and is highly scalable.
- Cons: More costly than object storage and generally slower at ingesting real-time data.
- Use cases: Storing aggregated or cleaned data that can be queried frequently for analytics. Common examples include Amazon Redshift and Google BigQuery.
These databases perform most efficiently when queries select only a few specific columns rather than querying all the columns in a table. This is because columnar storage is optimized for reading only the relevant data, leading to faster query performance when working with a subset of columns.
In-Memory Databases
In-memory databases store data in the system’s memory rather than on disk, allowing for extremely low-latency access, which is ideal for real-time analytics.
- Pros: Ultra-fast data access, ideal for transient or frequently updated data like user sessions or active user counts.
- Cons: Expensive at scale and not suited for long-term storage.
- Use cases: Storing high-frequency data points that need instant retrieval, such as real-time metrics or temporary session data. Examples include Redis and Memcached.
Hybrid Approaches
Combining different storage systems to leverage the strengths of each. For instance, raw data may be stored in a data lake for flexibility, while aggregated data is loaded into a data warehouse for fast queries.
- Pros: Maximizes storage cost-effectiveness and query performance, offering flexibility for both structured and unstructured data.
- Cons: Managing multiple systems introduces complexity, particularly in ensuring data consistency, security, and quality across the pipeline. This often involves the design, development, and maintenance of multiple ingestion pipelines to handle data properly at each stage.
- Use cases: Storing data that requires both long-term storage and real-time analytics capabilities. Often used by organizations with varied data needs, where raw data storage and structured querying are equally important.
Deciding which data destination to use
Selecting the right data destination depends on various factors, from data structure to query needs and scalability requirements. Here are some key decision points to guide the choice of data destination.
Data structure & type
- Structured data: Data warehouses are generally the preferred destination for structured data because they enforce schemas, making it easy to query and analyze data quickly.
- Unstructured or semi-structured data: Data lakes are better suited for unstructured or semi-structured data, as they allow data to be stored in its raw format, which is especially useful for logs, clickstream data, and images.
- Hybrid needs: When there’s a mix of structured and unstructured data, consider a hybrid approach where a data lake stores raw data and a data warehouse holds processed, structured data ready for analysis.
Query patterns & access needs
- Frequent access & complex analytics: Data warehouses and columnar databases are optimized for ad-hoc querying, data aggregation, and fast response times, which are essential for BI tools and reporting.
- Occasional access for deep data analysis: Data lakes are ideal for storing large volumes of data that may be accessed less frequently or for occasional, deep-dive analysis. They allow for cheaper storage and work well for exploratory or machine-learning workloads.
- Team collaboration and flexible access: Since data lakes store data in its raw, unstructured form, they are often more accessible to a variety of teams within an organization. Teams can access data as needed, without waiting for it to be pre-processed into a rigid schema, allowing for greater flexibility and collaboration across different departments.
- Real-time access: In-memory databases are best for low-latency access, suitable for real-time dashboards or metrics that need immediate availability.
Scalability & performance needs
- High scalability and long-term storage: Data lakes are generally more cost-effective for long-term, large-scale storage because they handle massive volumes of data without high costs. This makes them ideal for data growth projections.
- Performance optimization for analytics: Data warehouses can scale efficiently for fast querying but may come with higher costs as data grows. For large-scale data, look for cloud-native options that can dynamically allocate resources as data volume fluctuates.
- Cost-effective scalability: Hybrid solutions often balance the storage and cost demands by allowing organizations to store data in both a data lake and a warehouse. Raw data is kept cost-effectively in the lake, while summarized or transformed data is stored in a warehouse for high-performance querying.
Data retention & lifecycle management
- Long-term data storage: Data lakes are well-suited for data retention over long periods, especially for historical data. Using tiered storage, recent data can be stored in high-speed, high-cost storage while older data is transitioned to more economical long-term storage.
- Time-based lifecycle policies: Many ETL systems use lifecycle policies to automatically transition data based on age, storing recent data in a low-latency environment (e.g., a warehouse) and moving older, rarely accessed data to a data lake.
- Compliance & retention requirements: Consider data governance, retention periods, and compliance requirements when choosing destinations. For example, regulated data may need to be archived in a secure, compliant system for extended retention.
Cost considerations
- Storage costs: Data lakes generally offer cheaper storage options, especially for large, raw datasets. If budget is a concern, data lakes provide a scalable solution that minimizes costs.
- Computation costs: While data warehouses are more costly for storage, they offer efficient computation and query performance. Use them for data that requires frequent querying or that supports critical business operations.
- Cost balancing with hybrid systems: Hybrid approaches allow organizations to store raw data cost-effectively in a data lake and then copy processed, refined data to a warehouse for faster analytics, balancing both storage and computation expenses.
Future flexibility & integration needs
- Adaptability for future needs: Data lakes offer more flexibility for future analytics and machine-learning applications due to their ability to store unstructured data. They also adapt easily to schema changes, making them ideal for evolving data requirements.
- Integration with analytics tools: If the destination needs to support specific tools or BI applications, consider how each destination type integrates with those tools. Warehouses are typically BI-friendly, while lakes offer flexibility for machine learning and data science integration.
- Hybrid approach for versatility: A hybrid model allows for future expansion, supporting a broad range of analytics by keeping raw data in a lake and processed data in a warehouse. This dual approach offers a foundation that can adapt to both current and future use cases.
Best practices
- Align with long-term data strategy. Choose storage solutions that fit with the organization’s strategic goals. For example, if your organization plans to scale data analytics, opt for a flexible system that can accommodate future needs.
- Optimize for performance and cost. Use tiered storage where possible to optimize costs while meeting performance requirements. For instance, store frequently accessed data in low-latency systems and archive older data in data lakes.
- Ensure data governance and security. Choose destinations that support compliance requirements and implement data governance practices to secure sensitive data. This includes encryption and access controls on data warehouses and data lakes.
- Document destination choices. Keep clear documentation of why each data destination was chosen, so that you make adjustments based on the interviewer’s follow-up questions e.g. scaling the system.
Data lakes allow for the storage of raw, unstructured, or semi-structured data in its natural form. However, with flexibility comes challenges in governance. In data lakes, where data is stored in its raw and unstructured form, managing aspects like data lineage, data security, and data quality becomes crucial. It’s not only about protecting sensitive data but also about ensuring its integrity and traceability throughout its lifecycle.
To address these challenges, companies often rely on data governance and data quality tools such as Collibra and SODA. These tools help monitor and maintain the quality, security, and proper use of data across the pipeline, ensuring that governance practices are upheld even in flexible, unstructured environments like data lakes.