<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Oyeyemi Fagbuaro on Medium]]></title>
        <description><![CDATA[Stories by Oyeyemi Fagbuaro on Medium]]></description>
        <link>https://medium.com/@yemihelen406?source=rss-459d427c47b0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*j11ghx5cbIASfpXYNLRWQQ.jpeg</url>
            <title>Stories by Oyeyemi Fagbuaro on Medium</title>
            <link>https://medium.com/@yemihelen406?source=rss-459d427c47b0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 18:17:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yemihelen406/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[THE WOMAN IN THE PARK]]></title>
            <link>https://medium.com/@yemihelen406/the-woman-in-the-park-24a41217d6d3?source=rss-459d427c47b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/24a41217d6d3</guid>
            <dc:creator><![CDATA[Oyeyemi Fagbuaro]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 01:00:36 GMT</pubDate>
            <atom:updated>2026-03-11T01:00:36.808Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1INgDOdyO6wKUaKcyiPa2Q.jpeg" /><figcaption>Image credit: Sourced via Google Images.</figcaption></figure><p>I went to the park to just chill and relax and maybe find inspiration to write. I had barely sat down when I noticed a very beautiful woman nearby, we made eye contact, I smiled and she smiled back.</p><p>Few hours later, I was about leaving and noticed she was still there, alone. I wanted to approach to talk, but I shrugged it off and left. Afterall, What is meant to be will be.</p><p>A week later, I was at the Park again. this time around to read a novel and get some fresh air, and there she was. Same spot, looking so beautiful. I almost couldn’t take my eyes off her.</p><p>This must be a sign, I thought to myself. I decided to introduce myself and say hi. so, I walked up to her, greeted her, no response.</p><p>I said, “Hi, you’re here again, I saw you last week, do you come here often?</p><p>She ignored me like I was invisible, and didn’t even bother to turn around. I was too embarrassed. Walking back to my spot felt like the hardest thing ever.</p><p>It felt like the whole park was looking and laughing at me. I couldn’t even leave out of shame so I sat down and began thinking about my life.</p><p>I started reading my novel and few hours later, I felt a tap on my shoulder. It was the beautiful woman, smiling at me. I was confused.</p><p>“Hello, how are you doing, I hope I’m not disturbing you.” She said it so slowly. I was Confused.</p><p>Someone that ignored me a while ago now you’re smiling and talking to me. Hope you’re not about to ask me for money because I will insult you. I said in my mind.</p><p>I said “Its fine, how may I help you?”</p><p>She gave me her phone, in confusion I collected it and when I looked she had typed something</p><p>“Please, don’t take this the wrong way but I saw you last week and I wanted to talk to you but you left before I could. My name is Sharon, I like you and I want us to be friends”,</p><p>I looked around for the camera, sure that this must be some sort of prank. “But I just tried talking to you a while ago and you ignored me, now you’re here. I’m confused.”</p><p>she asked for her phone back. I handed her phone back to her and she started typing fast then immediately handed it back to me. More confused, I took the phone and again she had typed something</p><p>“I’m sorry, my hearing is impaired, and you were talking so fast I couldn’t read your lips. May I have your number so we can text instead”</p><p>It finally clicked. She hadn’t ignored me; She just couldn’t hear me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24a41217d6d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Difference between Views, Materialized Views and CTEs]]></title>
            <link>https://medium.com/@yemihelen406/difference-between-views-materialized-views-and-ctes-7dc4b3ad1a3a?source=rss-459d427c47b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/7dc4b3ad1a3a</guid>
            <dc:creator><![CDATA[Oyeyemi Fagbuaro]]></dc:creator>
            <pubDate>Sun, 11 May 2025 00:46:24 GMT</pubDate>
            <atom:updated>2025-05-11T01:01:44.907Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*QbFkuS-M2mxd7ZHSqYiBbQ.png" /></figure><p>SQL has some very useful advanced functions that help simplify complex queries or improve code readability. Among these are views, materialized views, and Common Table Expressions (CTEs). Each serve a unique purpose for handling intermediate query results. Understanding the differences between them can help you write more efficient SQL queries. This article will explore the key differences between them and why you might choose one over the other.</p><p><strong>VIEWS</strong></p><p>Views generally create tables from existing table in order to find information easily. They act as virtual tables representing a subset of data from one or more tables. it simplifies complex queries and saves you from writing the same code repeatedly. Instead of writing the same complex query repeatedly, you can define it as a view once and then query that view as if it were a regular table. They are created using the <strong>“CREATE VIEW”</strong> statement.</p><pre>CREATE VIEW SalesEmployee AS <br>SELECT employee_id, first_name, last_name<br>FROM employee<br>WHERE department = &#39;sales&#39;;<br><br>--Querying the view<br>SELECT * <br>FROM SalesEmployee;</pre><p>The use of views comes with several benefits. It hides the complexity of underlying tables and joins and present a simplified perspective of the data to the users. it can also be used to restrict access to certain columns or rows of a table thus enhancing data security. Another very important thing to note is that Every time you run a view, the database runs the search to get the latest/updated result.</p><p><strong>MATERIALZIED VIEWS</strong></p><p>Materialized views are precomputed views that are stored as tables. They are primarily used to improve query performance in databases or data warehouse. Unlike regular views, Materialized views store the actual data resulting from the query physically. Materialized view also might not show the latest result when it is run unlike regular view. To get the updated data, you need to refresh it.</p><p>Generally, retrieving data from a materialized view is faster because it avoids recomputing the query each time it is accessed.</p><pre>--Creating a materialized view using postgresql syntax. please not that<br>--the syntax might be slightly different in another SQL client such as <br>--Microsoft SQL server<br><br>CREATE MATERIALIZED VIEW customer_sales AS<br>SELECT c.customer_id, c.first_name, c.last_name,SUM(p.amount)AS total_spent<br>FROM customer AS c<br>INNER JOIN payment AS p<br>GROUP BY c.customer_id, c.first_name, c.last_name<br>ORDER BY total_spent DESC;<br><br>--Query the materialized view<br>SELECT * <br>FROM customer_sales;<br><br>--To update the data in the materialized view, you need to refresh it<br>REFRESH MATERIALIZED VIEW customer_sales;</pre><p><strong>Common Table Expressions (CTEs)</strong></p><p>A CTE is a very useful feature in SQL that allows for the creation of temporary result sets within a query. They are named temporary result set that exist only for the duration of the query. A CTE can be referenced within a <strong>‘SELECT’,</strong> <strong>‘INSERT’</strong>, <strong>‘UPDATE’,</strong> or <strong>‘DELETE’</strong> statement. The primary purpose of a CTE is to make complex queries more readable and manageable by breaking them down into logical steps. Unlike a view that can be queried multiple times by different queries as if it were a regular table, a CTE can only referenced within the specific query in which it is defined. you cannot call a CTE outside of that query. CTEs are used to enhance the readability and maintainability of SQL code. They are defined using the <strong>‘WITH’</strong> clause.</p><pre>WITH Countrysales AS (<br>     SELECT country, SUM(amount) AS total_sales<br>     FROM orders<br>     GROUP BY country<br>)<br>SELECT country<br>FROM countrysales<br>WHERE total_sales &gt; 1000;</pre><p><em>Thank you for reading</em></p><p>Connect with me on <a href="http://linkedin.com/in/fagbuarooyeyemihelen"><em>LinkedIn</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7dc4b3ad1a3a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Hierarchy of Database Objects]]></title>
            <link>https://medium.com/@yemihelen406/the-hierarchy-of-database-objects-f2846f24e8b1?source=rss-459d427c47b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2846f24e8b1</guid>
            <dc:creator><![CDATA[Oyeyemi Fagbuaro]]></dc:creator>
            <pubDate>Mon, 31 Mar 2025 02:00:05 GMT</pubDate>
            <atom:updated>2025-03-31T02:00:05.081Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*SewM_ljBEizXwAJ7EVwVUA.png" /></figure><p>Database Objects are the logical structures that organize, store and manage data within a database. They are the building blocks that make up a database’s architecture and functionality. Understanding the hierarchy of database objects across different Relational Database Management Systems (RDBMS) is crucial for data engineers, database administrators and other data professionals to effectively work with RDBMSes.</p><p>The hierarchical structure of database objects defines how database components relate to each other- from Instances and Schemas down to tables, indexes and constraints. By understanding these relationships, Data professionals can design more efficient databases, troubleshoot problems more effectively, and implement proper security measures. Whether you are designing a database, Optimizing queries, or ensuring data integrity, grasping the following hierarchy is essential for effective database management.</p><ol><li><em>Instances</em></li></ol><p>An instance sits at the highest level in the database objects hierarchy, serving as the foundation upon which all other database components are built. It represents a complete database environment, managing memory allocation, background processes, and system configurations necessary for database operations.</p><p>A single database instance can manage one or more databases. when multiple databases exist within an instance, each maintains its own schema, system catalogs, and settings, ensuring controlled access and isolation between them. This structure allows for better resource management, security and scalability in multi-database environments.</p><p>2<em>. Databases</em></p><p>Next is the Database itself. A database exists within an instance and serves as the repository where data is stored, organized and managed. It contains the schema, tables, views, indexes, and other objects necessary for structuring and accessing data efficiently.</p><p>3.<em> Schema</em></p><p>Next on the Hierarchy is the Schema. A Schema is a logical container within a database that groups related database objects such as tables, views, indexes, stored procedures, and triggers. It defines how the data is organized in a database and organizes the data. A schema specifies the types of data, relationships between different data elements, and the rules that govern the data.</p><p>In some database systems, schemas are directly tied to users, meaning each user owns a schema and its objects while in others schemas function as independent namespaces within a database, allowing different teams or applications to work on separate sets of objects without interference.</p><p><em>The database Objects within the Schema:</em></p><p>a. <strong>Tables:</strong> These are the primary data storage structures, organized in rows and columns.</p><p>b. <strong>Views</strong>: Virtual tables based on the result of a SELECT query.</p><p>c. <strong>Stored procedures</strong>: Predefined SQL Scripts that executes a set of operation.</p><p>d. <strong>Functions:</strong> Similar to stored procedures but return values.</p><p>e. <strong>Indexes</strong>: Improves query performance by optimizing data retrieval.</p><p>f. <strong>Triggers: </strong>Automatic actions that executes in response to certain events.</p><p>g. <strong>Sequences:</strong> Generates unique numbers, often for primary keys.</p><p>h. <strong>Constraints:</strong> Constraints enforces rules and restrictions on data. for example; ensuring that employee numbers remain unique.</p><p>i. <strong>Synonyms: </strong>Aliases for database objects to simplify queries.</p><p>j. <strong>User-Defined Types (UDTs):</strong> Custom data types defined by users.</p><p><em>Thank you for reading.</em></p><p>Connect with me on <a href="http://linkedin.com/in/fagbuarooyeyemihelen"><strong><em>LinkedIn</em></strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2846f24e8b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TOP 11 TIPS TO OPTIMIZE SQL QUERIES]]></title>
            <link>https://medium.com/@yemihelen406/top-11-tips-to-optimize-sql-queries-87b3667dcc5d?source=rss-459d427c47b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/87b3667dcc5d</guid>
            <dc:creator><![CDATA[Oyeyemi Fagbuaro]]></dc:creator>
            <pubDate>Sat, 15 Mar 2025 23:02:33 GMT</pubDate>
            <atom:updated>2025-03-15T23:02:33.921Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*GkurffYj6Y3Gh-Y-BEZJ9Q.png" /><figcaption>SQL Query Optimization</figcaption></figure><p>In Relational Databases, Optimizing SQL Queries is crucial for efficient data retrieval and processing, especially when dealing with large datasets and complex operations. Poorly Optimized queries can bring even powerful database systems to a crawl, increase server load and negatively impact user experience.</p><p>Proper SQL Query Optimization is invaluable because it brings about efficient database interactions that performs well even as your data grows. When working with large datasets, even an extra second or two in query execution can make a significant difference. Slow and inefficient queries can take up a lot of company resources. Not only do analysts and stakeholders waste time sitting and waiting, but many cloud platforms and data warehouses charge by the processing time and/or data processed. Proper Optimization can transform queries that once took minutes into operations that complete in milliseconds.</p><p>In this article, I will explain 10 essential query optimization tips that can help to improve performance, reduce execution time, and enhance overall database efficiency.</p><ol><li><strong>Indexing</strong>:</li></ol><p>Indexing is one of the most essential techniques for optimizing SQL Queries. An index is akin to an index in a book or a book’s table of content. Like a book’s table of content help a reader to quickly locate a particular page or topic without scanning the entire book, an index allows the database engine to find data quickly without scanning the entire the entire table.</p><p>Indexes are special lookup tables that are used by the database engine to accelerate data retrieval. It allows the database engine to locate rows efficiently. Without indexing, the database engine will need to perform a full table scan for each search, which results in longer query times, especially as the data grows and this could result in poor application performance, increased response times, and result inefficiency.</p><p>Example;</p><pre>--Creating an index the city column<br>CREATE INDEX idx_city ON Customers(city);</pre><pre>--Querying the Indexed Column<br>SELECT name, email<br>FROM Customers<br>WHERE city = &#39;London&#39;;</pre><p>Since the “city” column has been indexed, the database engine will quickly locate customers in London without scanning the entire table.</p><p>2. <strong>Avoid SELECT *</strong></p><p>SELECT * retrieves all the column in a table. Imagine you are working with a table with hundreds of columns, retrieving all the columns will most likely take a long time to process. The only exception is if you are limiting the number of rows to be returned. Instead of selecting all columns, specify only the required columns. By doing this, you minimize the amount of data to be retrieved, thereby reducing network load and the time taken to process and return the results.</p><p>Example;</p><pre>--Retrieving all columns (Replace table with actual table name)<br>SELECT * FROM table;</pre><pre>--Retrieving required columns (Replace column1,2,3 with actual column names and table with actual table name)<br>SELECT column1, column2, column3<br>FROM table;</pre><p>3. <strong>Use WHERE and LIMIT/TOP to filter rows</strong></p><p>If you are exploring just to get a good feel of the data available, it is best to use LIMIT or TOP (depending on the SQL client that you are using. LIMIT is used in PostgreSQL and TOP is used in Microsoft SQL Server) to reduce the number of rows to be returned instead of pulling in every single rows. Similarly, use the WHERE clause to filter out any unnecessary rows. Maybe you only need the transaction within a specified period or maybe you don’t really need every product or customers. Filtering data with the WHERE clause will drastically reduce the number of rows you are processing.</p><p>Example;</p><pre>--Using the LIMIT function<br>SELECT * <br>FROM table<br>LIMIT 100;<br><br>--Using the WHERE clause to filter data<br>SELECT column1, column2, column3<br>FROM table<br>WHERE city = &#39;London&#39;<br><br>--Using both WHERE and LIMIT function<br>--This query will return only the first 100 matching records<br>SELECT name, email<br>FROM customers<br>WHERE city = &#39;London&#39;<br>LIMIT 100;</pre><p>4. <strong>Use EXPLAIN:</strong></p><p>EXPLAIN is a SQL command that shows how the database executes a query. Rather than actually executing the query, it reveals the step-by-step approach the database will take, including the indexes, how tables will be joined, order of operations, and any filtering or sorting that is performed. By analyzing the output of EXPLAIN, you can identify areas of your query that may be causing performance issues and make adjustments accordingly.</p><p>Example;</p><pre>EXPLAIN SELECT * FROM customers <br>WHERE city = &#39;London&#39;;<br></pre><pre>--SQL Server does not use the EXPLAIN keyword like MySQL or PostgreSQL. <br>--Instead it uses the SET SHOWPLAN_ALL ON keyword<br><br>SET SHOWPLAN_ALL ON;<br>GO<br>SELECT * FROM customers WHERE city = &#39;London&#39;<br>GO<br>SET SHOWPLAN_ALL OFF;<br>GO </pre><p>5. <strong>Avoid using Wildcards at the beginning of a String</strong></p><p>Wildcards can be inefficient especially if SQL has to check for patterns in the middle of a string. If SQL looks for the pattern ‘Yemi%’, it only has to check for a match for the first 4 letters of each string. However, if SQL has to look for a pattern after a wildcard in a string like ‘%Yemi%’, SQL has a lot more work to do to figure out if that pattern is there or not. It forces SQL to do a full table scan to see if it matches or not. So, if you know the string you are looking for starts a certain way, never use wildcards at the beginning of a string. If you are looking for Yemi___, use ‘Yemi%’ and not ‘%Yemi% for better efficiency.</p><p>Example;</p><pre>SELECT name, email<br>FROM customers<br>WHERE name like &#39;yemi%&#39;;<br><br>--name like &#39;%yemi%&#39;</pre><p>6. <strong>Use Stored Procedures</strong></p><p>A stored procedure is a pre-compiled SQL code that can be executed multiple times, thereby, reducing parsing and execution time for repetitive tasks. Stored procedure is one of the most effective ways to optimize SQL query performance while simultaneously improving code organization and security.</p><p>Example;</p><pre>--Creating a stored procedure <br>CREATE PROCEDURE ordersbycustomer<br>  @customerID INT<br>AS<br>BEGIN<br>  SELECT * FROM orders WHERE customerID = @customerID<br>END;  </pre><pre>--Executing the Procedure<br><br>EXEC ordersbycustomer @customerID = 5;</pre><p>7. <strong>Use EXISTS instead of COUNT and IN</strong></p><p>If you are counting in a subquery or checking to see if something is in a subquery or not, use EXISTS instead COUNT and IN. This is because EXISTS is a lot faster than counting every single instance. Using EXISTS can be a great way to speed up processing time compared to COUNT(*) and IN.</p><p>Example;</p><pre>--This subquery counts all matching rows in projects for each employees, even though we only need to check if at least one row exists.<br>--This results in unnecessary processing, making it less efficient.<br>SELECT employee_id, name<br>FROM Employees<br>WHERE (SELECT COUNT(*)<br>        FROM projects<br>        WHERE project.employee_id = Employees.employee_id)&gt; 0;<br><br>vs<br>--EXISTS stops searching as soon as it finds one match, making it faster and more efficient.<br>SELECT employee_id, name<br>FROM Employees<br>WHERE EXSITS (SELECT 1<br>              FROM Projects<br>               WHERE Projects.employee_id = Employees.employee_id);</pre><p>8. <strong>Partitioning</strong></p><p>Partitioning is a technique for a large table into smaller, more manageable pieces called Partitions. Each partitions contains a specific subset of data determined by partition keys. Partitioning helps to optimize Query performance by reducing the amount of data that needs to be processed.</p><p>For example, Let’s consider a database that stores information about customers orders. If you frequently need to retrieve information about orders placed within a specific period, you could partition that table based on the order date. This will allow the database to quickly retrieve information about orders placed within this period without having to scan the entire table.</p><p>9. <strong>Avoid Subqueries</strong></p><p>Subqueries can significantly slow down query performance, especially when they return large result sets, as they often require additional processing for each row in the Outer query., leading to slower execution time. Instead, consider using JOINs or temporary tables, where necessary to optimize data retrieval.</p><p>10<strong>. Use Common Table Expressions (CTEs) when you will have to refer to a table/Output multiple times.</strong></p><p>If you are referring to the same output / calculation multiple times, use a CTE instead of a subquery or writing the query every time. CTEs can really speed up your queries when used properly because SQL only has to process it once but it can be used an infinite number of times.</p><h4>11. <strong>Use ORDER BY Sparingly</strong></h4><p>Sorting data with ORDER BY can be expensive, especially when applied to large datasets. It forces the database to process and arrange every row, thereby increasing query execution time. Avoid using ORDER BY in subqueries and CTEs, as it serves no real purpose until the final result is presented. In many SQL dialects, attempting to use ORDER BY within a subquery will either be ignored or throw an error. However, ORDER BY is essential in Window Functions, where it supports calculations rather than just sorting for presentation. Use ORDER BY <strong>only</strong> when necessary to optimize query performance.</p><p><em>Thank you for reading.</em></p><p>Connect with on <a href="http://linkedin.com/in/fagbuarooyeyemihelen"><em>LinkedIn</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87b3667dcc5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Database Consistency: ACID vs. BASE in Modern Systems]]></title>
            <link>https://medium.com/@yemihelen406/understanding-database-consistency-acid-vs-base-in-modern-systems-fa7874959043?source=rss-459d427c47b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa7874959043</guid>
            <dc:creator><![CDATA[Oyeyemi Fagbuaro]]></dc:creator>
            <pubDate>Sun, 23 Feb 2025 02:38:34 GMT</pubDate>
            <atom:updated>2025-02-23T02:38:34.095Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*3NpwyPJL-XhHaR1QMLS3eA.png" /><figcaption>ACID vs BASE Database Consistency Models</figcaption></figure><p>Databases are a foundational component of modern applications, ensuring data remains accurate, reliable and accessible. However, different database systems prioritize consistency in different ways, leading to two data consistency models- <strong>ACID (Atomicity, Consistency, Isolation, Durability) and BASE (Basically Available, Soft state, Eventually consistent). </strong>These models determine how databases manage transactions, maintain reliability and scale to meet increasing demands.</p><p>Understanding the difference between ACID and BASE models is crucial for developers, database administrators, data engineers and anyone involved in building and managing data-driven systems. Choosing the right model impacts not only data integrity but also system performance, availability and User experience. ACID guarantees strict consistency and is essential for applications like banking systems, while BASE offers flexibility and scalability, making it ideal for large-scale distributed systems such as social media platforms and real-time analytics.</p><p>In this article, I will explain the principles of ACID and BASE, compare their strengths and weaknesses, and their roles in shaping modern databases architectures.</p><p><strong>Database Consistency Model</strong></p><p>A database consistency model defines how a database ensures data remains accurate and reliable, especially when multiple users or processes are accessing and modifying it simultaneously. Think of it like a set of rules that governs how changes are applied and how data is presented to Users. Database consistency models are important because they directly impact data integrity, availability, system reliability, scalability and overall performance. They define expectations for data accuracy and stability, particularly in the face of concurrent operations and potential system failures. Within this framework, ACID and BASE models stand out as key approaches.</p><p><strong>ACID</strong></p><p>ACID model is a set of properties that ensure data integrity and Consistency in databases. <strong>It stands for Atomicity, Consistency, Isolation, Durability.</strong></p><p>Atomicity:</p><p>A transaction is treated as a single, indivisible unit. This ensures that all operations in a transaction are either fully completed or rolled back to their original state. If any part of the transaction fails, the entire operation is rolled back preventing partial updates. For instance, a bank transfer where money is deducted from one account but not added to another account would be rolled back to maintain consistency. Atomicity ensures that both operation happen together or not at all.</p><p>Consistency:</p><p>A transaction brings the database from one valid state to another. This ensures that database remains in valid state before and after a transaction and adheres to predefined constraints even after a transaction is completed. For instance, a customer adds a product to their cart and proceeds to checkout. The database checks if the product is in stock before the transaction starts, the transaction processes the payment and reduces the stock count by 1. If the transaction completes successfully, the new stock level is updated in the database and if any step fails (e.g. payment is declined), the stock count remains unchanged.</p><p>Isolation:</p><p>Isolation ensures that a concurrent transactions execute independently. Changes made by one transaction are not visible to other transactions until the first transaction is fully committed. This prevents concurrent transactions from interfering with each other thereby eliminating inconsistencies and data corruption and ensures that each transaction sees a consistent view of the database. For instance, Let’s say two users are making changes to the same customer order in the database. User A wants to change the shipping address and User B wants to change the order quantity. Isolation ensures that the changes made by User A are not visible to User B until User A’s transaction is complete. This prevents conflicting updates and ensures that each user sees a consistent view of the data.</p><p>Durability:</p><p>Durability ensures that committed transactions persists even in the face of network or power outages. It guarantees that once transactions are committed, all changes become permanent and are immune to subsequent system failures. This ensures that data is not lost and remains consistent even in the face of unexpected events. For instance, if a person books a flight online, after the booking process and transaction is committed, the booking details are permanently stored in the database. Even if the system crashes or there’s power outage, the booking data is preserved.</p><p><strong>ACID model is primarily used in relational databases such as MySQL, PostgreSQL, Oracle, Microsoft SQL Server.</strong> This is because relational databases are designed for Structured data with strict relationships and constraints.</p><p><strong>Use Cases for ACID Model</strong></p><p>ACID models are best suited for applications where strict data consistency, accuracy and transactional integrity are crucial such as;</p><ol><li>Financial Transactions: Banking systems, Online payment gateways and stock trading platforms rely heavily on ACID properties to ensure that financial transactions are accurate, consistent and secure.</li><li>E-Commerce: Online shopping carts, order processing systems and inventory management systems need ACID properties to guarantee that orders are placed correctly, inventory levels are updated accurately and payment information is processed securely. ACID model help to prevent issues such as Double orders, incorrect inventory counts and payment discrepancies.</li><li>Healthcare: Electronic health records, Medical billing systems and patient management systems rely on ACID properties to maintain integrity and confidentiality of sensitive patient data. ACID model ensures that medical records are updated accurately, patient information is secure and billing transactions are processed correctly.</li><li>Government and Public sector: System used for tax collections, voters registrations and public benefits management rely on ACID properties to maintain the integrity and reliability of sensitive data.</li><li>Manufacturing and Supply chain: Production scheduling systems, inventory control systems and supply chain management systems use ACID properties to ensure the accuracy and consistency of data related to production processes, inventory levels and supply chain operations.</li></ol><p><strong>Pros and Cons of ACID Model</strong></p><p>Pros</p><ol><li>Data Integrity: ACID model guarantees that transactions are complete and accurate, preventing data corruption and inconsistencies. This is crucial for applications where data accuracy is paramount, such as Financial systems and healthcare records.</li><li>Reliability: ACID ensures that transactions are durable and persistent, even in the event of system failures. This provides high level of reliability and ensures that data is not lost.</li><li>Concurrency Control: ACID provides mechanisms for managing concurrent access to data, preventing conflicts and ensuring data consistency. This is essential for applications with multiple users accessing the same data simultaneously.</li></ol><p>Cons</p><ol><li>Performance Overhead: Implementing ACID can impose performance overhead, especially for high volume transactions. The strict requirement of Atomicity, Consistency, Isolation and durability can add latency to transactions.</li><li>Complexity: Implementing ACID can be complex, requiring careful design and implementation of mechanisms for transaction management, concurrency control and data recovery.</li><li>Scalability Limitation: ACID models can be challenging to scale for very high volumes of transactions, as the overhead associated with ensuring ACID properties can become significant.</li><li>High Resource Consumption: ACID requires more memory and computing power to maintain consistency.</li><li>Potential Bottlenecks in High-Traffic Applications: ACID databases can become a bottleneck for systems requiring rapid reads/writes.</li><li>In some cases, the strict requirement of ACID may be an overkill. For applications where data consistency is not critical, alternative models such as BASE (Basically Available, Soft state, Eventual Consistent) may be more appropriate.</li></ol><p>BASE</p><p>BASE model is an acronym for Basically Available, Soft state, and Eventually consistent. It is a more relaxed approach to data consistency compared to the strict ACID model. <strong>BASE model is commonly used in Distributed and NOSQL Databases such as Apache Cassandra, MongoDB, Redis, etc. .</strong> Unlike ACID, which prioritizes strict consistency, BASE favors availability and performance by allowing temporary inconsistencies that eventually resolve over time.</p><p>Basically Available:</p><p>This means that the system is always available, even if some parts of the system are experiencing failures. For instance, In a social media platform, even if one server goes down, users should still be able to post and read content from other servers.</p><p>Soft State:</p><p>This means that data in the system is not always consistent and there might be temporary inconsistencies. For example, in a shopping cart application, the total price might not be immediately updated after adding an item, but it will eventually be consistent.</p><p>Eventually Consistent:</p><p>This means that data in the system will eventually become consistent but there might be a delay. For example, in a distributed database, data change made on one server might not be immediately visible on other servers, but they will eventually be replicated.</p><p><strong>Use Cases for BASE model</strong></p><ol><li>Social Media: Imagine you are posting a picture on Instagram, the picture might not be immediately visible to all your followers but it will eventually be replicated to all servers and become visible to everyone.</li><li>Online Shopping: When you add an item to your shopping cart, the total price might not be immediately updated. however, it will eventually be updated after the transaction is completed.</li><li>Cloud Storage: When you upload a file to a cloud storage service, the file might not be immediately available to all users. However, it will eventually be replicated to all servers and become available to everyone.</li></ol><p><strong>Pros and Cons of BASE model</strong></p><p>Pros</p><ol><li>High Availability: The system remains operational even if some data are inconsistent.</li><li>Scalability: Ideal for handling large-scale, distributed applications.</li><li>Low Latency: Faster responses since strict consistency checks are avoided.</li><li>Fault Tolerance: The system can continue functioning even if some nodes fail.</li></ol><p>Cons</p><ol><li>Potential Data Inconsistencies: BASE systems can have temporary data inconsistencies, which can be problematic for applications that require strong consistency.</li><li>Not suitable for Critical transactions: BASE model is not ideal for banking or financial systems where strong consistency is required.</li><li>Complex Application Logic: Developers need to implement logic to handle potential inconsistencies and ensure data is eventually reconciled, adding complexity to the application.</li></ol><p><strong>Difference between ACID and BASE models</strong></p><ol><li>Scalability: ACID- based systems typically scale vertically, meaning they require more powerful hardware to handle large workloads. This makes scaling expensive and challenging WHILE BASE-based systems are built for Horizontal scaling, allowing more servers to be added to distribute workload efficiently, making it ideal for large-scale applications.</li><li>Performance and Latency: ACID transactions can be slower because they require strict checks to ensure consistency, isolation and durability. This added complexity increases latency. WHILE BASE sacrifices these strict rules to increase performance, allowing the system to process transactions more quickly, even if some data is temporarily inconsistent.</li><li>Consistency: ACID model ensures Strong Consistency, meaning all database transactions must follow strict rules to keep data valid and accurate at all times. Any transaction that violates this is rolled back. WHILE BASE model follows eventual consistency, allowing data to be temporarily inconsistent but ensuring it will become consistent over time as updates propagates across the system.</li><li>Availability vs. Reliability: ACID model prioritizes Data Reliability by enforcing strict rules that ensure transactions are processed correctly, even if that means temporarily locking data and reducing system availability. WHILE BASE model prioritizes Availability, ensuring the system remains responsive even during failures, but at the cost of temporary inconsistencies.</li><li>Handling Distributed Systems: ACID model is traditionally used in centralized systems like relational databases, where strong consistency is easier to enforce. It struggles in distributed systems because network delays and failures can disrupt strict consistency guarantee. WHILE BASE model is designed for distributed systems and large-scale applications, where strict consistency is relaxed to allow the system to function smoothly even if some nodes have outdated data temporarily.</li></ol><p>The Choice between ACID and BASE model depends on the specific requirements of your application. If data integrity and consistency are paramount, then ACID is the preferred choice. If availability and Scalability are more important, then BASE is a better option.</p><p><em>Thank you for reading.</em></p><p><em>Connect with me on </em><a href="http://linkedin.com/in/fagbuarooyeyemihelen"><em>LinkedIn</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa7874959043" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Relational vs Non-Relational Databases- Choosing the right database for your application]]></title>
            <link>https://medium.com/@yemihelen406/relational-vs-non-relational-databases-choosing-the-right-database-for-your-application-317382ea5ed6?source=rss-459d427c47b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/317382ea5ed6</guid>
            <dc:creator><![CDATA[Oyeyemi Fagbuaro]]></dc:creator>
            <pubDate>Mon, 10 Feb 2025 12:28:01 GMT</pubDate>
            <atom:updated>2025-02-10T12:28:01.452Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Relational vs Non-Relational Databases- Choosing the right database for your application</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wFijqpUdb2K0yPvBBHQQ5Q.png" /><figcaption>Relational vs Non-Relational Databases</figcaption></figure><p>The way data is stored and and managed plays a critical role in the Performance, Scalability and Reliability of Modern systems. At the core of data storage lies two primary database types: <strong>Relational and Non-Relational databases. </strong>Each offers distinct ways of handling data, tailored to different needs and environments. Understanding these differences is key to making informed decisions about how to structure and manage data effectively.</p><p>In this article, I will break down the concepts of relational and non-relational databases, highlight their key features, unique approaches to data storage and real-world scenarios where each excels.</p><p><strong>Relational Databases</strong></p><p>A relational database is a system designed to store data in tables organized into rows and columns, with defined relationships between different tables. These relationships make it easy to understand how data in one table relate to data in another. Each row represents a unique record, while each column represents a specific attribute of that record. A Relational database is designed to store and manage structured data, where the schema is well-defined and consistent and it uses Structured Query Language (SQL) as its primary means of managing and manipulating data. Examples of Relational Databases include;<em> PostgreSQL</em>, <em>MySQL,</em> <em>Microsoft</em> <em>SQL Server, Oracle Databases</em>.</p><p><strong>Key Features of Relational Databases</strong></p><ol><li>Structure: Relational databases enforce a predefined schema, where the structure of the data is defined using tables, columns and relationships between tables. This ensures consistency and data integrity.</li><li>Data Relationships: Tables in a relational database are linked through keys (Primary and foreign keys) and constraints. This relationships help to reduce data redundancy and ensures easy retrieval of data.</li><li>ACID Compliance: Relational databases ensure data reliability and consistency through Atomicity, Consistency, Isolation and Durability (ACID) properties.</li><li>SQL (Structured Query Language): Relational databases uses SQL for managing and manipulating data. This allows for easy data retrieval, insertion, updating and deletion operations.</li><li>Database Normalization: Relational databases employs a design technique known an normalization that reduces data redundancy and improves data integrity.</li><li>Built-in Security: Relational databases provide robust security features, including User authentication and Role-based access controls (RBAC), ensuring that data access is limited to authorized users.</li></ol><p><strong>Use Cases for Relational Databases</strong></p><p>Relational Databases are particularly effective in environments where maintaining data integrity, ensuring consistency and managing well-defined relationships between data entities are essential. Here are some real-world scenarios where relational databases are commonly used:</p><ol><li>Online Shopping Platforms: Managing Customers details, orders and inventory.</li><li>Banking and Financial Services: Tracking customers accounts, transactions and loans.</li><li>Healthcare Systems: Storing Patients records, appointments and billing information.</li><li>Educational Institutions: Keeping tracks of student records, course enrollment, grades, attendance and course schedules.</li><li>Airline Reservation systems: Managing flight schedules, seat availability and passenger information.</li></ol><p><strong>Non-Relational Databases</strong></p><p>A Non-Relational Database, often referred to as NoSQL Database, provide a different approach to data storage and retrieval. It is a database design that enables the storage and querying of data outside the traditional structures found in relational databases. A non-relational database does not use the tabular schema of rows and columns found in relational databases. instead, it uses a storage model that is optimized for the specific requirements of the type of data being stored. Examples of Non-Relational databases includes; <em>MongoDB</em>, <em>Cassandra</em>,<em> Redis</em>, <em>Neo4j</em>.</p><p><strong>Categories of Non-Relational Database</strong></p><ol><li>Key-Value Stores: They organize data as simple key-value pairs, where a key uniquely identifies a value. They are the least complex of the NoSQL databases architecturally because they are represented as a <em>HashMap. </em>They are powerful for basic Create-Read-Update-Delete Operations. Key-value stores scale quite well and shard easily across “X” number of nodes and each shard would contain a range of keys and their associated values.</li><li>Document-Based NoSQL Database: The document-based NoSQL database uses documents to store data in the database. Each data is considered a document and typically stored in either JSON, BSON or XML format. In the document-based NoSQL database, the data can be accessed by using the index value that is assigned for faster querying.</li><li>Column-Based NoSQL Databases: These databases focus on columns and group of columns when storing and accessing data. Column “Families” are several rows, each with a unique key or identifier, that belongs to one or more columns. These columns are grouped together in families because they are often accessed together. Column-based NoSQL-databases are well-suited for handling large-scale sparse data.</li><li>Graph-Based NoSQL Databases: Graph-based NoSQL databases focus on the relationships between the elements. It stores the data in the form of nodes (entities) and edges (relationships), making them particularly useful for social networks, recommendation engines and fraud detection.</li></ol><p><strong>Key Features of Non-Relational Databases</strong></p><ol><li>Flexible Data Model: NoSQL databases offer a flexible data model that allows for the storage of various data formats, such as Key-value pairs, documents, columnar or graph-based structures.</li><li>Scalability: NoSQL databases are designed to scale horizontally, meaning they can handle large amounts of data by distributing them across multiple servers. These databases can scale out by adding more nodes to handle growing data volumes and traffic loads.</li><li>High Performance: NoSQL databases are optimized for fast data access and retrieval, often utilizing distributed processing and caching mechanisms to handle large data quickly.</li><li>Flexible Schema: NoSQL databases do not enforce a predefined schema, allowing for easy adaptability to evolving data structures and eliminating the need for upfront schema design.</li><li>Eventual Consistency: Instead of enforcing strict ACID (Atomicity, Consistency, Isolation, Durability) properties, many NoSQL databases embrace eventual consistency, which can improve performance and scalability in distributed systems.</li></ol><p><strong>Use Cases for Non-Relational Databases</strong></p><p>Non-Relational databases are particularly well-suited to environments where flexibility, scalability and high performance are paramount. Here are some common real-world scenarios where non-relational databases are used:</p><ol><li>Real-time Big Data Analytics: Managing rapidly changing data streams due to high performance and scalability such as log analysis, stock market updates, live chat features.</li><li>Internet of Things (IoT): Ideal for storing sensor data and telemetry from connected devices.</li><li>Geolocation data: Storing spatial data with efficient querying capabilities for location-based services.</li><li>E-commerce and Product Catalogs: The flexible data model allows for rapid adjustments to product catalogs, accommodating various attributes and metadata without requiring major schema changes.</li><li>Content Management Systems: Storing rich content with dynamic fields and flexible schema like blog posts with varying image sizes and tags.</li></ol><p><strong><em>Thanks for reading</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=317382ea5ed6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Overview of Data Repositories- Types of Data Repositories and their use cases]]></title>
            <link>https://medium.com/@yemihelen406/overview-of-data-repositories-types-of-data-repositories-and-their-use-cases-2940a57676c0?source=rss-459d427c47b0------2</link>
            <guid isPermaLink="false">https://medium.com/p/2940a57676c0</guid>
            <dc:creator><![CDATA[Oyeyemi Fagbuaro]]></dc:creator>
            <pubDate>Sun, 26 Jan 2025 13:24:07 GMT</pubDate>
            <atom:updated>2025-01-26T13:24:07.921Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*eFTaaWIzsIEiEQlt696-5Q.jpeg" /></figure><p>Data repositories are foundational to any data engineering workflow. However, the differences between the various types of repositories- Databases, Data Warehouses, Data Lake, Data Mart and Big data stores often leave a lot of new data engineers confused.</p><p>Understanding the distinctions between these types of repositories and their use cases is essential because it helps you select and design the right architecture for storing and analyzing data effectively.</p><p>In this article, I will break down the differences between databases, data warehouses, data lakes, data mart and big data stores with their use cases to guide you in choosing the right data repository for your specific needs.</p><p><strong>Data Repositories</strong></p><p>A data repository is a general term used to refer to data that has been collected, organized and isolated so that it can be used for business operations or mined for reporting and data analysis. They serve as organized systems where data can be stored securely, accessed easily and managed effectively. These repositories can range from small databases infrastructures to vast, scalable systems designed to handle big data.</p><p><strong>Types, Differences and use cases of the various data repositories</strong></p><ol><li><strong>Databases</strong></li></ol><p>A database is a collection of data designed for the input, storage, search and retrieval and modification of data. It is a collection of data which can be easily accessed, stored and managed. <strong>A Database Management System (DBMS) </strong>is a set of programs that creates and maintains the databases. It allows you to store, modify and extract information from the database using<strong> Queries. </strong>Several factors influence the choice of a database some of which are; Data types and structure, querying mechanisms, transaction speed and intended use of the data.</p><p><strong>Use cases for databases</strong></p><p>Some of the use cases for databases include;</p><ol><li>E-commerce : Storing product details, customers orders, shopping cart information and transaction histories.</li><li>Customer Relationship Management (CRM): Keeping track of customers interactions, contact details, sales history, etc.</li><li>Banking systems: Managing account balances, transactions and user login information.</li><li>Healthcare systems: Storing patients medical records, appointment details and prescription information.</li><li>Inventory management systems: Tracking product stock levels, supplier details and order details.</li></ol><p><strong>Data Warehouses</strong></p><p>A data warehouse is a central repository consolidating data from various sources using the ETL process (Extract, Transform, Load). It aggregates data from one or more sources into a single, central, consistent data store to support various data analytics requirements. A data warehouse enable organizations to centralize data from disparate data sources such as transactional systems, operational databases and flat files. It serves as single source of truth that empowers users to leverage all the company’s data and access that data more efficiently.</p><p><strong>Use Cases for Data Warehouses</strong></p><p>some of the use cases for data warehouse include;</p><ol><li>Sales Forecasting: Predicting future sales based on historical data and current trends.</li><li>Healthcare: Patient trend analysis, disease outbreak, prediction, treatment optimization, cost reduction and quality improvement.</li><li>Financial services: Fraud detection, risk assessment, portfolio management and compliance reporting.</li><li>Manufacturing: Inventory management, supply chain efficiency, quality control and predictive maintenance.</li><li>Marketing and sales: Campaign performance analysis, lead generation optimization, cost analysis and customer lifetime value calculations</li></ol><p><strong>Data Lake</strong></p><p>A data lake is a data repository that can store large amounts of structured, semi-structured and unstructured data in their native format, classified and tagged with metadata. Think of a data lake like a big storage pool where you can dump all kinds of data, in any format, without needing to organize it first. You do not need to define the structure and schema of data before loading the data into the data lake. You do not even need to know all the use cases for which you will be analyzing the data. However, this does not mean that a data lake is a place where data can be dumped without governance.</p><p><strong>Use Cases for data lake</strong></p><p>Some of the use cases for data lake include;</p><ol><li>IoT Data Storage and Processing: Collecting and analyzing data from IoT devices and sensors such as temperature, energy usage or device performance. Supporting real-time monitoring and alerts for IoT devices and systems.</li><li>Machine learning and AI: Providing raw data to train machine learning models and improve algorithms. Also, storing labeled and unlabeled data for AI applications like image recognition or natural language processing.</li><li>Media and Content management: Supporting advanced video/image analytics such as object detection or sentiment analysis.</li><li>Data Backup and Archival: Backing up large datasets, archiving old or infrequently used data for long-term retention.</li><li>Dynamic pricing: Utilizing real-time data to adjust prices based on market demands like in the case of ride-sharing services.</li></ol><p><strong>Data Marts</strong></p><p>A data mart is an isolated part of the larger enterprise data warehouse that is specifically built to serve a particular business function, purpose or community of users. They are designed to provide specific support for making tactical decisions, as such, data marts are focused only on the most relevant data which saves end users the time and effort that would otherwise be spent searching the data warehouse for insights. for example, the sales and finance departments in a company may have access to dedicated data marts that supply the data required for their quarterly sales reports, the marketing team may use data marts to analyze customer behavior data, the shipping and manufacturing departments may also have their own data marts</p><p><strong>Use cases for Data Marts</strong></p><p>Some of the use cases for data marts include;</p><ol><li>Financial Reporting for specific departments: Different departments within a company can access their own data marts to generate tailored financial reports relevant to their operations.</li><li>Retail analytics for specific store locations: A retail chain can utilize a data mart to analyze sales trends and customer behaviors at individual store levels.</li><li>Operation performance monitoring: A production team can use a data mart to monitor key performance indicators (KPIs) related to production efficiency and quality control.</li></ol><p><strong>Big Data Stores</strong></p><p>Big data stores handle very large data with distributed computational and storage infrastructure. These stores handle structured, semi-structured and unstructured data, supporting the requirements of big data analytics. Modern big data technologies are designed to handle Terabytes, Petabytes and even exabytes of data.</p><p><strong>Use cases for Big data stores</strong></p><p>Some use cases for big data stores include;</p><ol><li>Internet of Things (IoT) Applications: Powering smart city applications such as traffic monitoring, energy management.</li><li>Healthcare and Genomics: Storing and processing large-scale genomic data for medical research.</li><li>Media and Entertainment: Analyzing content consumption data to recommend shows, songs ( e.g. Sportify, Netflix, YouTube).</li><li>Financial Services: Risk analysis by processing historical market data, running complex financial simulations and predictive models.</li><li>Energy and Utilities: Monitoring and storing data from power grids to predict outages, analyzing energy consumption patterns to improve efficiency.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2940a57676c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>