<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mahina Sheikh</title>
    <description>The latest articles on DEV Community by Mahina Sheikh (@mahinash26).</description>
    <link>https://dev.to/mahinash26</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1070009%2F4284d7d5-4bf5-4304-a8c3-97a7db34c342.png</url>
      <title>DEV Community: Mahina Sheikh</title>
      <link>https://dev.to/mahinash26</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mahinash26"/>
    <language>en</language>
    <item>
      <title>Parallel Query Execution in PostgreSQL</title>
      <dc:creator>Mahina Sheikh</dc:creator>
      <pubDate>Thu, 31 Aug 2023 16:58:10 +0000</pubDate>
      <link>https://dev.to/mahinash26/parallel-query-execution-in-postgresql-2cd7</link>
      <guid>https://dev.to/mahinash26/parallel-query-execution-in-postgresql-2cd7</guid>
      <description>&lt;p&gt;PostgreSQL employs a Parallel Query feature that optimizes the execution of certain queries, boosting performance in multi-core systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Parallel Query
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Parallel Query is invoked when the optimizer deems it the most efficient strategy.&lt;/li&gt;
&lt;li&gt;It employs multiple background worker processes for concurrent execution.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Plan Structure
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A query plan with Parallel Query includes a Gather or Gather Merge node.&lt;/li&gt;
&lt;li&gt;The Gather node assembles the parallel execution results.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Parallel Execution Scope
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If the Gather node is at the plan's top, the entire query runs in parallel.&lt;/li&gt;
&lt;li&gt;If within the plan tree, only the nodes below it run in parallel.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Optimal Worker Count
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The planner determines the number of workers.&lt;/li&gt;
&lt;li&gt;The chosen workers execute the parallel portion of the query.&lt;/li&gt;
&lt;li&gt;The number of workers can be capped by max_parallel_workers_per_gather.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Leader's Role
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The session's main process becomes the leader.&lt;/li&gt;
&lt;li&gt;The leader reads the tuples generated by the workers.&lt;/li&gt;
&lt;li&gt;For small result sets, the leader assists in query speed-up.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Gather Merge Insight
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;When using Gather Merge nodes, workers produce sorted tuples.&lt;/li&gt;
&lt;li&gt;The leader merges and maintains the sort order.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;PostgreSQL's Parallel Query mechanism is a powerful tool for enhancing query performance. By leveraging multiple background workers, parallel execution optimizes data retrieval, particularly on multi-core systems. Through careful planning and an understanding of parallel execution's nuances, developers can harness this feature to accelerate query processing, delivering improved responsiveness and efficiency.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.postgresql.org/docs/current/how-parallel-query-works.html"&gt;parallel query&lt;/a&gt;&lt;/p&gt;

</description>
      <category>apacheage</category>
      <category>postgressql</category>
      <category>database</category>
      <category>parallelquery</category>
    </item>
    <item>
      <title>PostgreSQL's MVCC: Navigating Concurrent Data Access</title>
      <dc:creator>Mahina Sheikh</dc:creator>
      <pubDate>Thu, 31 Aug 2023 16:51:45 +0000</pubDate>
      <link>https://dev.to/mahinash26/postgresqls-mvcc-navigating-concurrent-data-access-4aoh</link>
      <guid>https://dev.to/mahinash26/postgresqls-mvcc-navigating-concurrent-data-access-4aoh</guid>
      <description>&lt;p&gt;PostgreSQL shines with its Multiversion Concurrency Control (MVCC) model. This approach empowers developers to ensure data consistency and boost performance in multiuser environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Snapshot Consistency
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;MVCC lets SQL statements operate on data snapshots, preventing inconsistent views caused by concurrent transactions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Lock-Free Efficiency
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Traditional locks for reading and writing data don't conflict in MVCC.&lt;/li&gt;
&lt;li&gt;Reading never blocks writing, and writing never blocks reading.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Serializable Snapshot Isolation (SSI)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;PostgreSQL takes MVCC further with SSI.&lt;/li&gt;
&lt;li&gt;Guarantees strict transaction isolation without performance trade-offs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Explicit Control
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Table- and row-level locking options are available.&lt;/li&gt;
&lt;li&gt;Useful for manual conflict management, though MVCC usually offers better performance.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Flexible Advisory Locks
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;PostgreSQL introduces advisory locks for broader use cases.&lt;/li&gt;
&lt;li&gt;Offers adaptable locks beyond transaction boundaries.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Concurrency Optimization
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;MVCC empowers developers for effective concurrent data handling.&lt;/li&gt;
&lt;li&gt;Balances data consistency and performance for seamless multiuser interactions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;PostgreSQL's MVCC is a pivotal tool for efficient concurrent data access. By embracing snapshots, avoiding lock conflicts, and leveraging advanced features like SSI, developers can create high-performance applications while upholding data integrity. Whether optimizing concurrency or building multiuser systems, PostgreSQL's MVCC is a valuable asset.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.postgresql.org/docs/current/mvcc-intro.html"&gt;mvcc&lt;/a&gt;&lt;/p&gt;

</description>
      <category>postgressql</category>
      <category>apacheage</category>
      <category>database</category>
      <category>mvcc</category>
    </item>
    <item>
      <title>PostgreSQL Triggers: Simplifying Automated Actions</title>
      <dc:creator>Mahina Sheikh</dc:creator>
      <pubDate>Thu, 31 Aug 2023 16:41:09 +0000</pubDate>
      <link>https://dev.to/mahinash26/postgresql-triggers-simplifying-automated-actions-22om</link>
      <guid>https://dev.to/mahinash26/postgresql-triggers-simplifying-automated-actions-22om</guid>
      <description>&lt;p&gt;PostgreSQL triggers offer a powerful mechanism for automating actions within the database.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trigger Basics
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Triggers execute specific functions automatically upon defined operations.&lt;/li&gt;
&lt;li&gt;They can be attached to tables, views, and foreign tables.&lt;/li&gt;
&lt;li&gt;Triggers can fire before, after, or instead of INSERT, UPDATE, DELETE, and TRUNCATE operations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Varieties of Triggers
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Row-Level Triggers: Executed once per modified row.&lt;/li&gt;
&lt;li&gt;Statement-Level Triggers: Executed once per SQL statement.&lt;/li&gt;
&lt;li&gt;INSTEAD OF Triggers: Used on views to modify underlying tables.&lt;/li&gt;
&lt;li&gt;BEFORE Triggers: Fired before the operation.&lt;/li&gt;
&lt;li&gt;AFTER Triggers: Fired after the operation.&lt;/li&gt;
&lt;li&gt;INSTEAD OF Triggers: Fired instead of operation (views only).&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Trigger Execution Sequence
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Triggers are invoked in alphabetical order by trigger name.&lt;/li&gt;
&lt;li&gt;If a BEFORE trigger returns NULL, subsequent triggers are not fired for that row.&lt;/li&gt;
&lt;li&gt;Statement-level triggers are executed even if no rows are affected.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Trigger Functions and Cascading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A trigger function is defined before creating the trigger.&lt;/li&gt;
&lt;li&gt;Trigger functions are invoked within the same transaction as the statement.&lt;/li&gt;
&lt;li&gt;Be cautious of cascading triggers that might lead to recursion.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Examining Trigger Data
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Trigger input data includes the type of event (e.g., INSERT, UPDATE) and arguments.&lt;/li&gt;
&lt;li&gt;Row-level triggers have access to NEW (INSERT/UPDATE) and OLD (UPDATE/DELETE) rows.&lt;/li&gt;
&lt;li&gt;Statement-level triggers can request transition tables to access affected rows.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Practical Uses of Triggers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Validation: Enforce data consistency with checks before modification.&lt;/li&gt;
&lt;li&gt;Auditing: Log changes for auditing purposes using AFTER triggers.&lt;/li&gt;
&lt;li&gt;Synchronization: Propagate updates to related tables.&lt;/li&gt;
&lt;li&gt;Default Values: Automatically insert default values.&lt;/li&gt;
&lt;li&gt;Data Transformation: Modify data based on specific criteria.&lt;/li&gt;
&lt;li&gt;View Modifications: Modify views with INSTEAD OF triggers.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;PostgreSQL triggers simplify and streamline tasks by automating specific actions in response to data modifications. By grasping the distinctions between row-level, statement-level, and INSTEAD OF triggers, developers can harness their power to enhance data integrity, tracking, and overall database functionality.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.postgresql.org/docs/current/trigger-definition.html"&gt;triggers&lt;/a&gt;&lt;/p&gt;

</description>
      <category>apacheage</category>
      <category>postgressql</category>
      <category>database</category>
      <category>triggers</category>
    </item>
    <item>
      <title>Navigating Locale Support in PostgreSQL</title>
      <dc:creator>Mahina Sheikh</dc:creator>
      <pubDate>Thu, 31 Aug 2023 16:35:09 +0000</pubDate>
      <link>https://dev.to/mahinash26/navigating-locale-support-in-postgresql-37k1</link>
      <guid>https://dev.to/mahinash26/navigating-locale-support-in-postgresql-37k1</guid>
      <description>&lt;p&gt;Locale support in PostgreSQL ensures applications honor cultural preferences like sorting, number formatting, and more. Let's explore the essentials of this feature:&lt;/p&gt;

&lt;h2&gt;
  
  
  Automatic Initialization and Customization
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;PostgreSQL uses ISO C and POSIX locale facilities from the OS.&lt;/li&gt;
&lt;li&gt;Locale settings are initialized during database cluster creation with initdb.&lt;/li&gt;
&lt;li&gt;Use --locale option with initdb to specify a different locale.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Different Contexts for Locale Selection
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;OS Environment: Sets initial locale defaults for the cluster.&lt;/li&gt;
&lt;li&gt;initdb Command-Line: Explicitly define locales during cluster creation.&lt;/li&gt;
&lt;li&gt;Database-Level: Individual databases can have distinct locales.&lt;/li&gt;
&lt;li&gt;Column-Level: Customize locale settings for specific table columns.&lt;/li&gt;
&lt;li&gt;Query-Specific: Choose locales for particular queries.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Locale Providers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;PostgreSQL supports multiple providers: libc (OS C library) and icu (external ICU library).&lt;/li&gt;
&lt;li&gt;Choose based on performance and customization needs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Performance Considerations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;While locales enhance localization, they can impact performance.&lt;/li&gt;
&lt;li&gt;They slow character handling and hinder index use with the LIKE clause.&lt;/li&gt;
&lt;li&gt;Use locales only when necessary.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Troubleshooting and Contribution
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Verify OS locale configurations with the locale -a command.&lt;/li&gt;
&lt;li&gt;Confirm PostgreSQL's locale with the SHOW command.&lt;/li&gt;
&lt;li&gt;Contribute to message translations for improved localization.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;PostgreSQL's locale support ensures applications cater to users' cultural preferences. By understanding initialization, customization, and performance trade-offs, developers can create applications aligned with linguistic and formatting choices.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.postgresql.org/docs/current/locale.html"&gt;locale&lt;/a&gt;&lt;/p&gt;

</description>
      <category>postgressql</category>
      <category>apacheage</category>
      <category>database</category>
      <category>localesupport</category>
    </item>
    <item>
      <title>PostgreSQL's Logical Replication</title>
      <dc:creator>Mahina Sheikh</dc:creator>
      <pubDate>Thu, 31 Aug 2023 16:30:11 +0000</pubDate>
      <link>https://dev.to/mahinash26/postgresqls-logical-replication-5b6i</link>
      <guid>https://dev.to/mahinash26/postgresqls-logical-replication-5b6i</guid>
      <description>&lt;p&gt;PostgreSQL offers a robust data replication approach: logical replication. Unlike physical replication, logical replication focuses on data objects and changes, utilizing replication identities like primary keys. This method provides fine-grained control over data sync and security.&lt;/p&gt;

&lt;h2&gt;
  
  
  Working
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Subscribers pull data from publications on the publisher.&lt;/li&gt;
&lt;li&gt;Initial snapshot copied to subscribers.&lt;/li&gt;
&lt;li&gt;Real-time changes transmitted for consistent updates.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Benefits
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Granular Changes: Efficiently sends incremental changes to subscribers.&lt;/li&gt;
&lt;li&gt;Trigger Support: Triggers fired for individual changes on subscribers.&lt;/li&gt;
&lt;li&gt;Consolidation: Merges databases for analytical tasks.&lt;/li&gt;
&lt;li&gt;Cross-Version Support: Replicates across different PostgreSQL versions.&lt;/li&gt;
&lt;li&gt;Cross-Platform Replication: Works across diverse platforms.&lt;/li&gt;
&lt;li&gt;Data Access Management: Offers controlled access to replicated data.&lt;/li&gt;
&lt;li&gt;Subset Sharing: Shares a database subset among multiple databases.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Subscriber Flexibility
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Subscriber acts as a typical PostgreSQL instance.&lt;/li&gt;
&lt;li&gt;Can publish to other databases with its publications.&lt;/li&gt;
&lt;li&gt;Minimizes conflicts if treated as read-only.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;PostgreSQL's logical replication ensures real-time data synchronization across databases. Its adaptability, consistency, and diverse applications make it indispensable for maintaining data accuracy in distributed setups.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.postgresql.org/docs/current/logical-replication.html"&gt;Logical Replication&lt;/a&gt;&lt;/p&gt;

</description>
      <category>postgressql</category>
      <category>database</category>
      <category>apacheage</category>
      <category>replication</category>
    </item>
    <item>
      <title>Text Search in PostgreSQL</title>
      <dc:creator>Mahina Sheikh</dc:creator>
      <pubDate>Thu, 31 Aug 2023 16:23:44 +0000</pubDate>
      <link>https://dev.to/mahinash26/text-search-in-postgresql-58f5</link>
      <guid>https://dev.to/mahinash26/text-search-in-postgresql-58f5</guid>
      <description>&lt;p&gt;Full Text Searching (FTS) in PostgreSQL revolutionizes document retrieval. FTS identifies relevant documents based on queries and ranks them by relevance. &lt;/p&gt;

&lt;h2&gt;
  
  
  Key Limitations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;No linguistic support for derived words, leading to missed matches.&lt;/li&gt;
&lt;li&gt;No effective ranking, making it sluggish for numerous matches.&lt;/li&gt;
&lt;li&gt;Slower performance due to lacking index support.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FTS Solution
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Preprocesses documents for indexing efficiency.&lt;/li&gt;
&lt;li&gt;Parses documents into tokens, converts to normalized lexemes.&lt;/li&gt;
&lt;li&gt;Employs dictionaries for stop words, synonyms, and mapping.&lt;/li&gt;
&lt;li&gt;Utilizes &lt;code&gt;tsvector&lt;/code&gt; for preprocessed documents and &lt;code&gt;tsquery&lt;/code&gt; for queries.&lt;/li&gt;
&lt;li&gt;Core &lt;code&gt;@@&lt;/code&gt; operator for FTS matches.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Advantages
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Efficiently handles diverse queries and linguistic variations.&lt;/li&gt;
&lt;li&gt;Enables ranking and relevance-based ordering.&lt;/li&gt;
&lt;li&gt;Accelerates searches through indexing.&lt;/li&gt;
&lt;li&gt;Customizable configurations for parsing and normalization.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In PostgreSQL, FTS empowers accurate, efficient, and dynamic text searches, enhancing database capabilities.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.postgresql.org/docs/current/textsearch-intro.html#TEXTSEARCH-DOCUMENT"&gt;text search&lt;/a&gt;&lt;/p&gt;

</description>
      <category>postgressql</category>
      <category>apacheage</category>
      <category>database</category>
      <category>textsearch</category>
    </item>
    <item>
      <title>Monitoring Disk Usage in PostgreSQL</title>
      <dc:creator>Mahina Sheikh</dc:creator>
      <pubDate>Mon, 31 Jul 2023 16:55:33 +0000</pubDate>
      <link>https://dev.to/mahinash26/monitoring-disk-usage-in-postgresql-3h8c</link>
      <guid>https://dev.to/mahinash26/monitoring-disk-usage-in-postgresql-3h8c</guid>
      <description>&lt;p&gt;In any database management system, monitoring disk usage is a crucial task for administrators to ensure the efficient functioning of the system. In PostgreSQL, understanding the disk space occupied by tables and indexes is essential for optimizing performance and preventing potential issues. &lt;/p&gt;

&lt;p&gt;PostgreSQL stores data in primary heap disk files, with the possibility of a TOAST file for columns containing wide values. Each table and index resides in a separate disk file, with naming conventions described in Section 73.1 of the PostgreSQL documentation.&lt;/p&gt;

&lt;p&gt;There are three ways to monitor disk space in PostgreSQL:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Using SQL Functions:&lt;/strong&gt;&lt;br&gt;
   PostgreSQL provides SQL functions that allow you to easily query and determine the disk usage of any table. One such function is &lt;code&gt;pg_relation_filepath(oid)&lt;/code&gt;, which returns the file path of a table's disk file. For instance, to check the disk usage of a table named 'customer', you can execute the following query:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;   &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;pg_relation_filepath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;oid&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;relpages&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;pg_class&lt;/span&gt; &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;relname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'customer'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;relpages&lt;/code&gt; column represents the number of pages allocated to the table, with each page typically being 8 kilobytes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Using oid2name Module:&lt;/strong&gt;&lt;br&gt;
   Another approach to monitor disk space is through the oid2name module, which helps map object IDs (OIDs) to their corresponding names. While this method is useful, it is generally recommended to use the SQL functions for simplicity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Manual Inspection of System Catalogs:&lt;/strong&gt;&lt;br&gt;
   Administrators can directly inspect the system catalogs to understand disk usage. However, this method is more complex and less recommended than the SQL functions.&lt;/p&gt;

&lt;p&gt;When dealing with potentially wide values, PostgreSQL utilizes a TOAST table to store data that does not comfortably fit in the main table. Indexes are vital for optimizing query performance, and monitoring their sizes is equally important.Prevent disk full failures by proactively managing disk space, deleting unnecessary data, and utilizing tablespaces to move files. Timely action is crucial to avoid performance issues and disruptions in the database operations. Regular monitoring ensures a healthy and efficient PostgreSQL database.&lt;/p&gt;

&lt;p&gt;Monitoring disk usage in PostgreSQL is an integral part of database administration. By utilizing SQL functions and inspecting system catalogs, administrators can effectively determine the disk space used by tables, indexes, and TOAST tables. Additionally, being proactive in managing disk space and preventing disk full failures is crucial to ensure smooth database operations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.postgresql.org/docs/15/diskusage.html"&gt;Reference&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Embracing the Power of Graph Databases</title>
      <dc:creator>Mahina Sheikh</dc:creator>
      <pubDate>Mon, 31 Jul 2023 16:47:13 +0000</pubDate>
      <link>https://dev.to/mahinash26/embracing-the-power-of-graph-databases-41be</link>
      <guid>https://dev.to/mahinash26/embracing-the-power-of-graph-databases-41be</guid>
      <description>&lt;p&gt;In recent years, alternative types of databases have emerged to address specific challenges. Among these, Graph Databases have gained significant attention for their ability to handle highly connected data efficiently. Today, we'll delve into the fascinating world of Graph Databases, exploring how PostgreSQL and Apache AGE together offer a powerful multi-model approach.&lt;/p&gt;

&lt;p&gt;To address the need for versatility and to make the most of graph database capabilities, a hybrid approach emerges as an innovative solution. PostgreSQL, a reliable and high-performing open-source database, is known for its extensibility through add-ons called extensions. Among these powerful extensions, Apache AGE stands out as a bridge between relational, document, and graph databases.&lt;/p&gt;

&lt;p&gt;In a traditional relational model, querying for all comments made by users who are friends with each other might involve multiple complex JOIN operations. However, with Apache AGE's graph database capabilities, we can achieve this with a single expressive Cypher query.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Traditional SQL Query:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT comments.comment_text
FROM users
JOIN friendships ON users.id = friendships.user_id
JOIN comments ON comments.user_id = friendships.friend_id
WHERE users.username = 'JohnDoe';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Cypher Query using Apache AGE:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MATCH (user:User { username: 'JohnDoe' })-[:FRIENDS_WITH]-(friend:User)
MATCH (friend)-[:WROTE]-&amp;gt;(comment:Comment)
RETURN comment.comment_text;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In conclusion, going multi-model with PostgreSQL and Apache AGE presents an exciting opportunity to embrace the power of graph databases while retaining the familiarity of SQL and relational databases. This hybrid approach allows developers to build applications that can effortlessly traverse complex relationships while benefiting from the stability and performance of PostgreSQL.&lt;/p&gt;

</description>
      <category>apacheage</category>
      <category>postgressql</category>
      <category>database</category>
      <category>graphs</category>
    </item>
    <item>
      <title>Unleashing the Power of B-Tree Indexes in PostgreSQL</title>
      <dc:creator>Mahina Sheikh</dc:creator>
      <pubDate>Mon, 31 Jul 2023 16:36:27 +0000</pubDate>
      <link>https://dev.to/mahinash26/unleashing-the-power-of-b-tree-indexes-in-postgresql-2fik</link>
      <guid>https://dev.to/mahinash26/unleashing-the-power-of-b-tree-indexes-in-postgresql-2fik</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Among the various tools PostgreSQL employs to guarantee this reliability, the B-Tree index data structure takes center stage. Its versatility allows indexing any data type with a well-defined linear order, making it a formidable solution for diverse use cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Behavior of B-Tree Operator Classes
&lt;/h2&gt;

&lt;p&gt;The B-Tree operator classes serve as PostgreSQL's representation and understanding of sorting semantics. With five essential comparison operators (&amp;lt;, &amp;lt;=, =, &amp;gt;=, and &amp;gt;), they facilitate sorting and comparison within the B-Tree index. Notably, the &amp;lt;&amp;gt; operator is omitted, as its utility in index searches is limited.&lt;/p&gt;

&lt;p&gt;To optimize performance and enable cross-type comparisons, operator classes can be grouped into families. These families contain single-type operators and support functions for each data type, with additional cross-type comparison operators in a more flexible arrangement. Ensuring transitivity and consistency in these comparisons is crucial for reliable indexing.&lt;/p&gt;

&lt;p&gt;67.3. B-Tree Support Functions&lt;/p&gt;

&lt;p&gt;B-Tree operator families are fortified with support functions to enhance their capabilities. These functions include:&lt;/p&gt;

&lt;p&gt;Order: The comparison support function that returns values for A &amp;lt; B, A = B, and A &amp;gt; B conditions.&lt;/p&gt;

&lt;p&gt;Sortsupport: Optional functions for efficient sorting comparisons, optimizing query performance.&lt;/p&gt;

&lt;p&gt;In_range: Optionally extends semantics to support window clauses in certain query types.&lt;/p&gt;

&lt;p&gt;Equalimage: Allows PostgreSQL to determine when B-Tree deduplication optimization is safe, significantly reducing storage needs.&lt;/p&gt;

&lt;p&gt;Options: Reserved for future use, provides operator class-specific options, though currently not widely utilized in B-Tree indexes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Implementation
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;B-Tree Structure&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;PostgreSQL's B-Tree indexes manifest as multi-level tree structures, where internal pages point to child pages. The root page sits at the top, while leaf pages contain tuples pointing to table rows. Page splits and root page splits accommodate the insertion of new data when a page becomes full.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bottom-up Index Deletion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Under MVCC, duplicate versions of logical table rows may accumulate, impacting query performance. To address this, B-Tree indexes employ bottom-up index deletion, efficiently cleaning up version churn from updates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Deduplication&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;B-Tree deduplication is an optional technique to merge duplicate tuples into a space-efficient representation called posting list tuples. This significantly reduces storage requirements and boosts query performance. Deduplication is triggered during index insertion and can be selectively disabled if necessary.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, B-Tree indexes in PostgreSQL offer a reliable and versatile solution for efficient data retrieval. Understanding their behavior and support functions unlocks their full potential, making them a key tool for optimizing database performance and ensuring data integrity. With this knowledge, developers can harness the power of B-Tree indexes to build robust applications on the PostgreSQL platform.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.postgresql.org/docs/15/btree.html"&gt;Reference&lt;/a&gt;&lt;/p&gt;

</description>
      <category>postgressql</category>
      <category>database</category>
      <category>sql</category>
      <category>apacheag</category>
    </item>
    <item>
      <title>Reliability in PostgreSQL</title>
      <dc:creator>Mahina Sheikh</dc:creator>
      <pubDate>Mon, 31 Jul 2023 16:29:44 +0000</pubDate>
      <link>https://dev.to/mahinash26/reliability-in-postgresql-5h7f</link>
      <guid>https://dev.to/mahinash26/reliability-in-postgresql-5h7f</guid>
      <description>&lt;p&gt;Reliability holds immense importance in a robust database system, and PostgreSQL is fully dedicated to ensuring a dependable operation. In this blog post, I will explore the significance of reliability in database systems, which plays a crucial role in preserving data integrity and safeguarding against potential failures.&lt;/p&gt;

&lt;p&gt;In the context of a database system, reliability implies that all data from a committed transaction must be securely stored in a nonvolatile location, protected from power outages, operating system glitches, and hardware malfunctions. PostgreSQL achieves this by writing data to the computer's permanent storage, typically using disk drives. The remarkable aspect is that even in the event of a catastrophic computer failure, as long as the disk drives remain intact, they can be moved to another computer with similar hardware, and all committed transactions will be preserved.&lt;/p&gt;

&lt;p&gt;However, ensuring data is written to disk is not as simple as it sounds. Disk drives are much slower than main memory and CPUs, which leads to several layers of caching between the main memory and disk platters. To tackle this, PostgreSQL employs operating system buffer cache features to force writes from the cache to disk. Yet, there are additional caches in disk drive controllers and the disk drives themselves that can pose reliability hazards, especially those with volatile write-back caches.&lt;/p&gt;

&lt;p&gt;To mitigate these risks, administrators must take measures like disabling write-back caching when necessary and choosing disk controllers with battery-backup units (BBUs) that preserve cache contents during power failures.&lt;/p&gt;

&lt;p&gt;In any serious database system, reliability is of paramount importance, and PostgreSQL leaves no stone unturned in its pursuit of dependable operation. This makes it a powerful and robust solution for mission-critical applications where data reliability is crucial.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.postgresql.org/docs/current/wal-reliability.html"&gt;Reference&lt;/a&gt;&lt;/p&gt;

</description>
      <category>postgressql</category>
      <category>apacheage</category>
      <category>database</category>
      <category>sql</category>
    </item>
    <item>
      <title>A Journey Through Time: The Fascinating History of PostgreSQL</title>
      <dc:creator>Mahina Sheikh</dc:creator>
      <pubDate>Sun, 30 Jul 2023 09:18:51 +0000</pubDate>
      <link>https://dev.to/mahinash26/a-journey-through-time-the-fascinating-history-of-postgresql-2om1</link>
      <guid>https://dev.to/mahinash26/a-journey-through-time-the-fascinating-history-of-postgresql-2om1</guid>
      <description>&lt;p&gt;PostgreSQL, now hailed as the most advanced open-source database available, has an intriguing history that traces back to the late 1980s. Its evolution from the Berkeley POSTGRES Project to the robust PostgreSQL we know today is a testament to the dedication of its creators and the thriving open-source community.&lt;/p&gt;

&lt;p&gt;The Berkeley POSTGRES Project, spearheaded by Professor Michael Stonebraker and sponsored by DARPA, ARO, NSF, and ESL, Inc., commenced in 1986. The initial concepts and data model were presented in the late '80s, and by 1987, the first operational "demoware" system wowed audiences at the ACM-SIGMOD Conference. Version 1 was released to external users in June 1989, and subsequent versions addressed issues and added new features.&lt;/p&gt;

&lt;p&gt;Postgres95 marked a significant milestone in the project's history. In 1994, Andrew Yu and Jolly Chen introduced an SQL language interpreter to the system, giving birth to Postgres95. This open-source descendant of the original POSTGRES code retained the Berkeley heritage but boasted improved performance and maintainability. The introduction of SQL as the query language replaced PostQUEL, making it more familiar to developers. A new front-end library, libpgtcl, enabled interaction with Tcl-based clients, expanding its usability.&lt;/p&gt;

&lt;p&gt;In 1996, recognizing the need for a name that could withstand the test of time, the project adopted a new identity: PostgreSQL. The version numbering was reset to 6.0, aligning with the sequence established by the Berkeley POSTGRES project. This transition marked a turning point, shifting the focus from problem identification and understanding to feature augmentation and expansion. Throughout its history, PostgreSQL has continued to grow and flourish under the collaborative efforts of its dedicated community.&lt;/p&gt;

&lt;p&gt;As PostgreSQL continues to evolve, the story of its origin serves as a reminder of the innovative spirit and collaboration that drives the open-source community. With an ever-expanding set of features and capabilities, PostgreSQL remains a formidable force in the world of databases, cementing its place as a testament to the power of open-source development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.postgresql.org/docs/current/history.html"&gt;https://www.postgresql.org/docs/current/history.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>postgressql</category>
      <category>database</category>
      <category>apacheage</category>
    </item>
    <item>
      <title>Mastering Data Manipulation in PostgreSQL</title>
      <dc:creator>Mahina Sheikh</dc:creator>
      <pubDate>Sun, 30 Jul 2023 09:17:13 +0000</pubDate>
      <link>https://dev.to/mahinash26/mastering-data-manipulation-in-postgresql-1m0f</link>
      <guid>https://dev.to/mahinash26/mastering-data-manipulation-in-postgresql-1m0f</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;PostgreSQL, the top open-source database management system, offers a wide selection of commands to manage data manipulation tasks effectively. This blog will go over essential data manipulation methods and provide examples using PostgreSQL.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Inserting Data:&lt;/strong&gt;&lt;br&gt;
PostgreSQL provides the capability of putting data into a database using the INSERT command. If we take the 'products' table as an example, which contains columns like 'product_no,' 'name,' and 'price,' then it must be populated with data before becoming useful.&lt;/p&gt;

&lt;p&gt;Example 1: Insert a single row with values explicitly listed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSERT INTO products (product_no, name, price) VALUES (1, 'Cheese', 9.99);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example 2: Insert multiple rows in a single command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;INSERT INTO products (product_no, name, price) VALUES
    (3, 'Milk', 2.99),
    (4, 'Eggs', 3.49),
    (5, 'Butter', 4.29);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Updating Data:&lt;/strong&gt;&lt;br&gt;
PostgreSQL offers the UPDATE command to alter any existing data in a table. This command requires you to specify the particular table, column, and new value that you want to update as well as provide a condition that states which rows should be updated.&lt;/p&gt;

&lt;p&gt;Example 3: Update multiple columns simultaneously.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;UPDATE products SET name = 'Cheddar', price = 11.99 WHERE product_no = 1;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Deleting Data:&lt;/strong&gt;&lt;br&gt;
PostgreSQL provides the DELETE command as an option for deleting unwanted data. It requires a condition to be specified, so that it can accurately determine which rows to delete from a table.&lt;/p&gt;

&lt;p&gt;Example 4: Delete all products with a price of 0.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DELETE FROM products WHERE price = 0;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;4. Returning Data from Modified Rows:&lt;/strong&gt;&lt;br&gt;
The RETURNING clause in INSERT, UPDATE, and DELETE commands enables the retrieval of data from records that have been altered. This is advantageous when it is necessary to access the results of a modification without having to conduct extra queries.&lt;/p&gt;

&lt;p&gt;Example 5: Use RETURNING with UPDATE to retrieve updated data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;UPDATE products SET price = price * 1.10 WHERE price &amp;lt;= 99.99 RETURNING name, price AS new_price;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;PostgreSQL offers robust data management capabilities, allowing users to easily add, modify, and remove information. Having a firm understanding of these commands is critical for using PostgreSQL productively. With an adept knowledge of data manipulation in PostgreSQL, you can be sure to address any database task confidently and unlock the full capability of this flexible open-source system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.postgresql.org/docs/current/dml.html"&gt;https://www.postgresql.org/docs/current/dml.html&lt;/a&gt;&lt;/p&gt;

</description>
      <category>postgressql</category>
      <category>database</category>
      <category>apacheage</category>
      <category>agedb</category>
    </item>
  </channel>
</rss>
