<?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: Maruf13</title>
    <description>The latest articles on DEV Community by Maruf13 (@maruf13).</description>
    <link>https://dev.to/maruf13</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%2F446745%2F7e3b5545-b22a-4fa9-b837-68e8e245cd45.jpg</url>
      <title>DEV Community: Maruf13</title>
      <link>https://dev.to/maruf13</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maruf13"/>
    <language>en</language>
    <item>
      <title>How does RTE work?</title>
      <dc:creator>Maruf13</dc:creator>
      <pubDate>Mon, 12 Jun 2023 13:13:42 +0000</pubDate>
      <link>https://dev.to/maruf13/how-does-rte-work-57ke</link>
      <guid>https://dev.to/maruf13/how-does-rte-work-57ke</guid>
      <description>&lt;p&gt;The RelTableEntry (RTE) data structure is commonly used in computer programming to represent a relationship between two entities in a relational database or other similar data models. It serves as a way to store and manage the connections or associations between different entities.&lt;/p&gt;

&lt;p&gt;Here is a detailed explanation of how the RTE data structure works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Purpose: The RTE is designed to capture the relationship between two entities in a database. For example, in a simple e-commerce system, you might have two entities: "Customers" and "Orders." The RTE would store the relationship between a specific customer and their corresponding orders.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Attributes: An RTE typically consists of attributes that describe the relationship between the entities. These attributes depend on the specific context and requirements of the system. In the e-commerce example, the RTE might contain attributes like "CustomerID," "OrderID," "Date," "Quantity," etc., to represent the customer's order.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Primary Keys: RTEs often use primary keys to uniquely identify each entry. In the e-commerce example, the primary key could be a combination of "CustomerID" and "OrderID" to ensure that each RTE represents a unique customer-order relationship.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Foreign Keys: The RTE also utilizes foreign keys to establish a connection with the corresponding entities. In the e-commerce example, the foreign keys would link the RTE to the specific customer and order entities by referencing their respective primary keys.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Integrity: The RTE helps enforce data integrity by providing referential integrity between entities. This means that an RTE cannot exist unless the associated entities it refers to also exist. In our example, an RTE representing a customer's order cannot exist unless both the customer and the order exist in the system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Querying and Manipulation: The RTE allows for efficient querying and manipulation of relationship data. For example, you can retrieve all the orders placed by a particular customer by searching for RTEs with a specific "CustomerID." Similarly, you can modify or delete a specific RTE to update or remove a relationship.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Indexing: To improve performance, RTEs can be indexed based on their attributes. Indexing allows for faster searching and retrieval of relationship data. In our e-commerce example, you might create an index on the "CustomerID" attribute to speed up queries related to specific customers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Storage: RTEs are typically stored in a database table or a similar data structure. Each row in the table represents an RTE entry, with columns corresponding to the attributes of the RTE. The database management system provides mechanisms for efficiently storing, managing, and querying the RTE data.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Overall, the RelTableEntry (RTE) data structure is a useful tool for representing and managing relationships between entities in a database or other data models. It enables efficient querying, data integrity enforcement, and facilitates the manipulation of relationship data.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ References:&lt;/code&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://age.apache.org/"&gt;https://age.apache.org/&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/apache/age"&gt;https://github.com/apache/age&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.interdb.jp/pg/index.html"&gt;https://www.interdb.jp/pg/index.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>agedb</category>
      <category>postgres</category>
      <category>rte</category>
      <category>apacheage</category>
    </item>
    <item>
      <title>RelTableEntry (RTE): A Comprehensive Study</title>
      <dc:creator>Maruf13</dc:creator>
      <pubDate>Thu, 08 Jun 2023 04:34:19 +0000</pubDate>
      <link>https://dev.to/maruf13/reltableentry-rte-a-comprehensive-study-9g1</link>
      <guid>https://dev.to/maruf13/reltableentry-rte-a-comprehensive-study-9g1</guid>
      <description>&lt;p&gt;RTE is a fundamental data structure used in relational database management systems (RDBMS). It represents a table entry or a record within a database table and contains metadata about the attributes (columns) of the table. This post explores the purpose, components, and significance of RTE in RDBMS.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ Purpose of RTE:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;RTE serves multiple purposes within the context of RDBMS. Its primary objectives include:&lt;br&gt;
   &lt;strong&gt;- Metadata Storage:&lt;/strong&gt; RTE stores essential metadata about database tables, including attribute names, data types, constraints, and other properties.&lt;br&gt;
   &lt;strong&gt;- Query Optimization:&lt;/strong&gt; RTE assists in query optimization by providing necessary information for cost estimation, join ordering, and access path selection.&lt;br&gt;
   &lt;strong&gt;- Data Management:&lt;/strong&gt; RTE facilitates efficient data manipulation operations such as querying, inserting, updating, and deleting data, ensuring data integrity and consistency.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ Components of RTE:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The RTE data structure typically comprises various components that collectively store information about a table and its attributes. The common components include:&lt;br&gt;
   &lt;strong&gt;- Table Name:&lt;/strong&gt; The name of the table associated with the RTE.&lt;br&gt;
   &lt;strong&gt;- Attribute Information:&lt;/strong&gt; RTE contains information about each attribute (column) of the table, including attribute name, data type, length, constraints, and indexing status.&lt;br&gt;
   &lt;strong&gt;- Access Permissions:&lt;/strong&gt; RTE stores access permissions for the table, determining who can perform specific operations on it, such as read, write, or modify.&lt;br&gt;
   &lt;strong&gt;- Statistics:&lt;/strong&gt; RTE may include statistical information about the table, such as cardinality, distribution, or histograms, which aids in query optimization.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ RTE in Query Planning and Execution:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;RTE plays a crucial role in the query planning and execution phases of an RDBMS. Its usage can be observed in various stages, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Query Parsing: During parsing, the RTE data structure is constructed based on the tables referenced in the query, capturing their metadata and attributes.&lt;/li&gt;
&lt;li&gt;Query Optimization: RTE provides critical information used by the query optimizer to estimate costs, determine the most efficient join order, and select appropriate access paths.&lt;/li&gt;
&lt;li&gt;Query Execution: During execution, RTE is used to access the relevant table's data, apply constraints and filters, and ensure data integrity while performing data manipulation operations.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ Significance of RTE:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The significance of RTE lies in its contributions to efficient and effective database management. Some key aspects of its significance are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Performance Optimization: RTE enables query optimization, leading to improved query execution times and resource utilization.&lt;/li&gt;
&lt;li&gt;Data Integrity: RTE ensures data integrity by enforcing constraints and providing information on attribute types, lengths, and indexing.&lt;/li&gt;
&lt;li&gt;Schema Management: RTE assists in managing the database schema by storing attribute metadata and access permissions for each table.&lt;/li&gt;
&lt;li&gt;Access Control: RTE plays a vital role in access control, allowing administrators to define and enforce access permissions for different users or roles.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ RTE in Practice:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;RTE finds practical applications in various areas, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Relational Database Management Systems: RTE is a fundamental component of RDBMS, forming the backbone of data storage, retrieval, and management.&lt;/li&gt;
&lt;li&gt;Query Optimization: RTE plays a crucial role in optimizing query performance, ensuring efficient execution of complex SQL queries.&lt;/li&gt;
&lt;li&gt;Database Administration: RTE provides vital information for database administrators to manage schemas, optimize performance, and enforce security policies.&lt;/li&gt;
&lt;li&gt;Data Warehousing and Analytics: RTE supports efficient data storage and retrieval in data warehousing and analytics environments, enhancing the performance of analytical queries.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ Limitations of RTE:&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Memory usage: RTE can consume a significant amount of memory, especially in large databases. This can be a problem for databases that are running on systems with limited memory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Complexity: RTE can add some complexity to PostgreSQL applications. This is because developers need to be aware of how RTE works in order to use it effectively.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Overhead: RTE can add some overhead to PostgreSQL queries. This is because the PostgreSQL query planner needs to take RTE into account when planning queries.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;RelTableEntry (RTE) is a fundamental data structure in relational database management systems. It captures metadata about table attributes, supports query optimization, and facilitates efficient data management operations. RTE's significance lies in its role in&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ References:&lt;/code&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://age.apache.org/"&gt;https://age.apache.org/&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/apache/age"&gt;https://github.com/apache/age&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.interdb.jp/pg/index.html"&gt;https://www.interdb.jp/pg/index.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>Methods of reading database Tables</title>
      <dc:creator>Maruf13</dc:creator>
      <pubDate>Sun, 28 May 2023 15:56:08 +0000</pubDate>
      <link>https://dev.to/maruf13/methods-of-reading-database-tables-3a12</link>
      <guid>https://dev.to/maruf13/methods-of-reading-database-tables-3a12</guid>
      <description>&lt;p&gt;In this post, Two typical access methods, sequential scan and B-tree index scan, are outlined here:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ Sequential scan:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;All tuples in all pages are sequentially read by scanning all line pointers in each page. show below-&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fb3NDFMZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yavrvf6vpdpkqjxrlvt4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fb3NDFMZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yavrvf6vpdpkqjxrlvt4.png" alt="Sequential Scan" width="800" height="976"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ B-tree index scan:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;An index file contains index tuples, each of which is composed of &lt;strong&gt;an index key&lt;/strong&gt; and a TID pointing to the target heap tuple. &lt;br&gt;&lt;br&gt;
If the index tuple with the key that you are looking for has been found, PostgreSQL reads the desired heap tuple using the obtained TID value. &lt;br&gt;&lt;br&gt;
For example, In below image , TID value of the obtained index tuple is ‘(block = 7, Offset = 2)’. It means that the target heap tuple is 2nd tuple in the 7th page within the table, so PostgreSQL can read the desired heap tuple without unnecessary scanning in the pages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bjLdb7ni--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h6ymg5v2tleuxpzq4yvu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bjLdb7ni--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h6ymg5v2tleuxpzq4yvu.png" alt="B-tree index scan" width="800" height="928"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ References:&lt;/code&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://age.apache.org/"&gt;https://age.apache.org/&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/apache/age"&gt;https://github.com/apache/age&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.interdb.jp/pg/index.html"&gt;https://www.interdb.jp/pg/index.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>apacheage</category>
      <category>database</category>
      <category>postgres</category>
      <category>agedb</category>
    </item>
    <item>
      <title>Join Operations In PostgreSQL</title>
      <dc:creator>Maruf13</dc:creator>
      <pubDate>Sat, 27 May 2023 17:00:15 +0000</pubDate>
      <link>https://dev.to/maruf13/join-operations-5554</link>
      <guid>https://dev.to/maruf13/join-operations-5554</guid>
      <description>&lt;p&gt;In this post, we will discuss about various Join Operations in PostgreSQL. PostgreSQL supports three join operations: nested loop join, merge join and hash join. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YSsDwPBc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u3nb30k5ige3muymminr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YSsDwPBc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u3nb30k5ige3muymminr.png" alt="Join Operations" width="800" height="331"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note that the three join methods supported by PostgreSQL can perform all join operations, not only INNER JOIN, but also LEFT/RIGHT OUTER JOIN, FULL OUTER JOIN and so on:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ Nested loop join:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The nested loop join is the most fundamental join operation, and it can be used in any join conditions. PostgreSQL supports the nested loop join and four variations of it. which are-:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Basic Nested loop join&lt;/li&gt;
&lt;li&gt;Materialized Nested Loop Join&lt;/li&gt;
&lt;li&gt;Indexed Nested Loop Join&lt;/li&gt;
&lt;li&gt;With outer index scan&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ Merge join:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Unlike the nested loop join, merge join can be only used in natural joins and equi-joins.&lt;/p&gt;

&lt;p&gt;The cost of the merge join is estimated by the initial_cost_mergejoin() and final_cost_mergejoin() functions.&lt;/p&gt;

&lt;p&gt;As the exact cost estimation is complicated, it is omitted and only the runtime order of the merge join algorithm is shown. The start-up cost of the merge join is the sum of sorting costs of both inner and outer tables; Similar to the nested loop join, the merge join in PostgreSQL has Three variations.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Basic Merge Join&lt;/li&gt;
&lt;li&gt;Materialized Merge Join&lt;/li&gt;
&lt;li&gt;With outer index scan&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ Hash join:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Similar to the merge join, the hash join can be only used in natural joins and equi-joins. The hash join in PostgreSQL behaves differently depending on the sizes of the tables. If the target table is small enough (more precisely, the size of the inner table is 25% or less of work_mem), it will be a simple two-phase in-memory hash join; otherwise, the hybrid hash join is used with the skew method.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ References:&lt;/code&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://age.apache.org/"&gt;https://age.apache.org/&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/apache/age"&gt;https://github.com/apache/age&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.interdb.jp/pg/index.html"&gt;https://www.interdb.jp/pg/index.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>postgres</category>
      <category>apacheage</category>
      <category>agedb</category>
      <category>database</category>
    </item>
    <item>
      <title>Apache AGE Intro-2</title>
      <dc:creator>Maruf13</dc:creator>
      <pubDate>Tue, 16 May 2023 11:27:20 +0000</pubDate>
      <link>https://dev.to/maruf13/apache-age-intro-2-965</link>
      <guid>https://dev.to/maruf13/apache-age-intro-2-965</guid>
      <description>&lt;p&gt;In this article, I have discussed about data types in Apache AGE. AGE uses a custom data type called agtype, which is the only data type returned by AGE. Below we have classified Simple Data Types in AGE:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;1. Null:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;In Cypher, null is used to represent missing or undefined values. Conceptually, null means ‘a missing unknown value’ and it is treated somewhat differently from other values. For example getting a property from a vertex that does not have said property produces null. &lt;br&gt;
Not knowing two values does not imply that they are the same value. So the expression null = null yields null and not true.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
    RETURN NULL
$$) AS (null_result agtype);
A null will appear as an empty space.

Result:

null_result
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;code&gt;2. Integer:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The integer type stores whole numbers, i.e. numbers without fractional components. Integer data type is a 64-bit field that stores values from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Attempts to store values outside this range will result in an error.&lt;/p&gt;

&lt;p&gt;The type integer is the common choice, as it offers the best balance between range, storage size, and performance. The smallint type is generally used only if disk space is at a premium. The bigint type is designed to be used when the range of the integer type is insufficient.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
    RETURN 1
$$) AS (int_result agtype);
Result:

int_result
1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;code&gt;3. Float:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The data type float is an inexact, variable-precision numeric type, conforming to the IEEE-754 Standard.&lt;/p&gt;

&lt;p&gt;Inexact means that some values cannot be converted exactly to the internal format and are stored as approximations, so that storing and retrieving a value might show slight discrepancies. Managing these errors and how they propagate through calculations is the subject of an entire branch of mathematics and computer science and will not be discussed here, except for the following points:&lt;/p&gt;

&lt;p&gt;If you require exact storage and calculations (such as for monetary amounts), use the numeric type instead.&lt;/p&gt;

&lt;p&gt;If you want to do complicated calculations with these types for anything important, especially if you rely on certain behavior in boundary cases (infinity, underflow), you should evaluate the implementation carefully.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
    RETURN 1.0
$$) AS (float_result agtype);
Result:

float_result
1.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;code&gt;4. Numeric:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The type numeric can store numbers with a very large number of digits. It is especially recommended for storing monetary amounts and other quantities where exactness is required. Calculations with numeric values yield exact results where possible, e.g., addition, subtraction, multiplication. However, calculations on numeric values are very slow compared to the integer types, or to the floating-point type.&lt;/p&gt;

&lt;p&gt;We use the following terms below: The precision of a numeric is the total count of significant digits in the whole number, that is, the number of digits to both sides of the decimal point. The scale of a numeric is the count of decimal digits in the fractional part, to the right of the decimal point. So the number 23.5141 has a precision of 6 and a scale of 4. Integers can be considered to have a scale of zero.&lt;/p&gt;

&lt;p&gt;In addition to ordinary numeric values, the numeric type allows the special value NaN, meaning “not-a-number”. Any operation on NaN yields another NaN. When writing this value as a constant in an SQL command, you must put quotes around it, for example UPDATE table SET x = ‘NaN’.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
    RETURN 1.0::numeric
$$) AS (numeric_result agtype);
Result:

numeric_result
1.0::numeric
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;code&gt;5. Bool:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;AGE provides the standard Cypher type boolean. The boolean type can have several states: “true”, “false”, and a third state, “unknown”, which is represented by the Agtype null value.&lt;/p&gt;

&lt;p&gt;Boolean constants can be represented in Cypher queries by the keywords TRUE, FALSE, and NULL.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
    RETURN TRUE
$$) AS (boolean_result agtype);
Unlike Postgres, AGE’s boolean outputs as the full word, ie. true and false as opposed to t and f.

Result:

boolean_result
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;code&gt;6. String:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Agtype strings String literals can contain the following escape sequences:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Escape Sequence Character
\t  Tab
\b  Backspace
\n  Newline
\r  Carriage Return
\f  Form Feed
\’    Single Quote
\”    Double Quote
\\  Backslash
\uXXXX  Unicode UTF-16 code point (4 hex digits must follow the \u)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Input/Output Format&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT *
FROM cypher('graph_name', $$
    RETURN 'This is a string'
$$) AS (string_result agtype);
Result:

string_result
“This is a string”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;code&gt;✔️ References:&lt;/code&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://age.apache.org/"&gt;https://age.apache.org/&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/apache/age"&gt;https://github.com/apache/age&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.interdb.jp/pg/index.html"&gt;https://www.interdb.jp/pg/index.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://joefagan.github.io/age_docs/"&gt;https://joefagan.github.io/age_docs/&lt;/a&gt; &lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>apacheage</category>
      <category>database</category>
      <category>agedb</category>
      <category>postgres</category>
    </item>
    <item>
      <title>PostgreSQL Query Processing</title>
      <dc:creator>Maruf13</dc:creator>
      <pubDate>Tue, 16 May 2023 11:01:21 +0000</pubDate>
      <link>https://dev.to/maruf13/postgresql-query-processing-3mii</link>
      <guid>https://dev.to/maruf13/postgresql-query-processing-3mii</guid>
      <description>&lt;p&gt;In PostgreSQL, the parallel query uses multiple background worker processes. A backend process basically handles all queries issued by the connected client. This backend consists of five subsystems, as shown below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ReHqKRsU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/co1gqtk24tss3cb966d8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ReHqKRsU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/co1gqtk24tss3cb966d8.png" alt="Query image processing" width="800" height="897"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;1. Parser:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The parser generates a parse tree from an SQL statement in plain text.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;2. Analyzer:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The analyzer/analyser carries out a semantic analysis of a parse tree and generates a query tree.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;3. Rewriter:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The rewriter transforms a query tree using the rules stored in the rule system if such rules exist.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;4. Planner:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The planner generates the plan tree that can most effectively be executed from the query tree.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;5. Executor:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The executor executes the query via accessing the tables and indexes in the order that was created by the plan tree.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ References:&lt;/code&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://age.apache.org/"&gt;https://age.apache.org/&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/apache/age"&gt;https://github.com/apache/age&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.interdb.jp/pg/index.html"&gt;https://www.interdb.jp/pg/index.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>apacheage</category>
      <category>postgresq</category>
      <category>aged</category>
      <category>database</category>
    </item>
    <item>
      <title>Apache AGE Intro</title>
      <dc:creator>Maruf13</dc:creator>
      <pubDate>Sun, 16 Apr 2023 19:00:11 +0000</pubDate>
      <link>https://dev.to/maruf13/apache-age-1ge8</link>
      <guid>https://dev.to/maruf13/apache-age-1ge8</guid>
      <description>&lt;p&gt;Apache AGE is a &lt;strong&gt;PostgreSQL extension&lt;/strong&gt; that provides &lt;em&gt;&lt;strong&gt;graph database functionality&lt;/strong&gt;&lt;/em&gt;. AGE is inspired by Bitnine’s fork of PostgreSQL 10, AgensGraph, which is a &lt;strong&gt;multi-model&lt;/strong&gt; database. The goal of the project is &lt;u&gt;to create single storage&lt;/u&gt; that can &lt;em&gt;&lt;strong&gt;handle both relational and graph model&lt;/strong&gt;&lt;/em&gt; data so that users can use standard ANSI SQL along with openCypher, the Graph query language.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ Graphs:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;A graph consists of a set of &lt;strong&gt;vertices/nodes and edges&lt;/strong&gt;, which shows a map of properties. A node is independent block in the graph. An edge creates a &lt;strong&gt;directed connection&lt;/strong&gt; between two vertices.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Create a Graph&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
To create a graph, use below function from &lt;strong&gt;ag_catalog&lt;/strong&gt; namespace:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;create_graph(graph_name); #Returns: void
Example:
SELECT * FROM ag_catalog.create_graph('graph_name');
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;code&gt;Cypher Query Format&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
Cypher queries are-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cypher(graph_name, query_string, parameters) 
    #Return A SET OF records 
    #parameters is optional &amp;amp; by default NULL
Example:
SELECT * FROM cypher('graph_name', $$/* Cypher Query Here */ $$) 
AS (result1 agtype, result2 agtype);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;code&gt;Delete a Graph&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
To delete a graph, use the below function, form &lt;strong&gt;ag_catalog&lt;/strong&gt; namespace:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;drop_graph(graph_name, cascade); #Returns: void
Example:
SELECT * FROM ag_catalog.drop_graph('graph_name', true);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;code&gt;✔️ References:&lt;/code&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://age.apache.org/"&gt;https://age.apache.org/&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/apache/age"&gt;https://github.com/apache/age&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.interdb.jp/pg/index.html"&gt;https://www.interdb.jp/pg/index.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://joefagan.github.io/age_docs/"&gt;https://joefagan.github.io/age_docs/&lt;/a&gt; &lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>apacheage</category>
      <category>database</category>
      <category>postgres</category>
      <category>agedb</category>
    </item>
    <item>
      <title>Optimization Techniques in Apache AGE</title>
      <dc:creator>Maruf13</dc:creator>
      <pubDate>Sat, 15 Apr 2023 06:30:07 +0000</pubDate>
      <link>https://dev.to/maruf13/optimization-techniques-in-apache-age-51o0</link>
      <guid>https://dev.to/maruf13/optimization-techniques-in-apache-age-51o0</guid>
      <description>&lt;p&gt;Apache AGE is a powerful tool for graph processing and analysis. Here are some techniques you can consider to optimize the performance of AGE and improve query performance:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;1. Schema Design:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Optimizing your schema design is critical for good performance in any graph database, including AGE. Properly defining your vertex and edge properties, and organizing them in a way that reflects the nature of your data and queries, can greatly impact query performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;2. Indexing:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Creating appropriate indexes on your graph data can significantly speed up query performance. AGE supports indexing on vertex and edge properties, and you can choose between different types of indexes, such as &lt;strong&gt;B-trees or GIN (Generalized Inverted Index)&lt;/strong&gt;, depending on your use case.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;3. Query Optimization:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;AGE supports various query optimization techniques, such as query planning and cost-based optimization. Make sure to optimize your queries to take advantage of these features, such as using the appropriate graph traversal methods, minimizing redundant calculations, and leveraging AGE's built-in query optimization capabilities.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;4. Data Loading:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Efficiently loading data into AGE can also impact performance. Consider using batch loading techniques, such as bulk loading or parallel loading, to load data into AGE more efficiently and reduce overhead.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;5. Resource Allocation:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Properly allocating system resources, such as CPU cores, memory, and storage, can have a significant impact on AGE's performance. Monitor and adjust resource allocations based on the size and complexity of your graph data, and consider leveraging distributed computing techniques if dealing with large-scale graphs.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;6. Hardware Optimization:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Optimizing the hardware environment where AGE is running can also impact performance. Consider using high-performance storage systems, optimizing network configurations, and using hardware accelerators, such as GPUs, for certain graph processing tasks, if applicable.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;7. Avoiding Performance Pitfalls:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;There are some common pitfalls to avoid while optimizing AGE's performance. For example, avoiding excessively complex or deeply nested queries, avoiding unnecessary data duplication, and being mindful of memory usage can help improve performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;8. Monitoring and Profiling:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Regularly monitoring and profiling the performance of AGE can help identify bottlenecks and areas for optimization. Leverage AGE's built-in monitoring tools, such as query profiling and system metrics, to gain insights into the performance of your graph database.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;9. Keep AGE Up-to-Date:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;AGE is an actively developed project, so make sure to keep your AGE installation up-to-date with the &lt;strong&gt;latest stable release to take advantage of bug fixes&lt;/strong&gt;, performance improvements, and new features.&lt;/p&gt;

&lt;p&gt;Optimizing AGE's performance requires a good understanding of your data, queries, and system environment. Experimenting with different optimization techniques and measuring their impact on query performance can &lt;em&gt;help you identify the best strategies for your specific use case&lt;/em&gt;. Remember to thoroughly test any optimizations in a development or staging environment before deploying them in production.&lt;/p&gt;

</description>
      <category>apacheage</category>
      <category>databse</category>
      <category>agedb</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Database Cluster Layout</title>
      <dc:creator>Maruf13</dc:creator>
      <pubDate>Tue, 28 Mar 2023 21:22:20 +0000</pubDate>
      <link>https://dev.to/maruf13/database-cluster-layout-44ka</link>
      <guid>https://dev.to/maruf13/database-cluster-layout-44ka</guid>
      <description>&lt;p&gt;In this post, we will discuss the Cluster Database Layout of PostgreSQL. &lt;br&gt;&lt;br&gt;
The layout of database cluster has been shown below. Main files and subdirectories in a part of the document have been listed here:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f0yAIkmf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/87vec0c2jyu9ywnyb25a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f0yAIkmf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/87vec0c2jyu9ywnyb25a.png" alt="Database Cluster Layout" width="880" height="1076"&gt;&lt;/a&gt;&lt;br&gt;
In here, &lt;strong&gt;demo&lt;/strong&gt; is a database cluster. Under the &lt;strong&gt;Database Cluster&lt;/strong&gt; it has 6 files which are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;pg_hba.conf:&lt;/strong&gt; Used for PosgreSQL's client authentication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pg_ident.conf:&lt;/strong&gt; Used for controlling PostgreSQL's user name mapping&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;PG_VERSION:&lt;/strong&gt; Containing version number of PostgreSQL&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;postgresql.conf:&lt;/strong&gt; Used for settin configuration parameters&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;postgresql.auto.conf:&lt;/strong&gt; In ALTER SYSTEM, it is stored configuration parameters. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;postmaster.opts:&lt;/strong&gt; Record the last command line options for the server.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In here, &lt;strong&gt;demo&lt;/strong&gt; has 17 directories which are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;base:&lt;/strong&gt; &lt;em&gt;Subdirectory containing per-database subdirectories&lt;/em&gt;. A database is a subdirectory under the base subdirectory; and the database directory names are identical to the respective OIDs. For example, when the OID of the database is 16384, its subdirectory name is 16384.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CTgcNddh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ragdvxibfguyx2gah0na.png" alt="base" width="608" height="576"&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;global:&lt;/strong&gt; It contains cluster-wide tables, such as pg_database and pg_control.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pg_commit_ts:&lt;/strong&gt; Subdirectory containing transaction commit timestamp data. Version 9.5 or later.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pg_dynshmem:&lt;/strong&gt;Subdirectory containing files used by the dynamic shared memory subsystem. Version 9.4 or later.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pg_logical:&lt;/strong&gt;Subdirectory containing status data for logical decoding. Version 9.4 or later.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pg_multixact:&lt;/strong&gt;Subdirectory containing multitransaction status data (used for shared row locks)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pg_notify:&lt;/strong&gt;Subdirectory containing LISTEN/NOTIFY status data&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pg_replslot:&lt;/strong&gt;Subdirectory containing replication slot data. Version 9.4 or later.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pg_serial:&lt;/strong&gt;Subdirectory containing information about committed serializable transactions (version 9.1 or later)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pg_snapshots:&lt;/strong&gt;Subdirectory containing exported snapshots (version 9.2 or later). The PostgreSQL's function pg_export_snapshot creates a snapshot information file in this subdirectory.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pg_stat:&lt;/strong&gt;Subdirectory containing permanent files for the statistics subsystem.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pg_stat_tmp:&lt;/strong&gt;Subdirectory containing temporary files for the statistics subsystem.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pg_subtrans:&lt;/strong&gt; Containing &lt;strong&gt;subtransaction status data&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pg_tblspc:&lt;/strong&gt; Containing &lt;strong&gt;symbolic links to tablespaces&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pg_twophase:&lt;/strong&gt; Containing state files for prepared transactions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pg_wal:&lt;/strong&gt; Containing &lt;strong&gt;WAL (Write Ahead Logging) segment files&lt;/strong&gt;. It is renamed from &lt;strong&gt;pg_xlog&lt;/strong&gt; in Version 10.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;pg_xact:&lt;/strong&gt; Containing &lt;strong&gt;transaction commit state data&lt;/strong&gt;. It is renamed from &lt;strong&gt;pg_clog&lt;/strong&gt; in Version 10.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ References:&lt;/code&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://age.apache.org/"&gt;https://age.apache.org/&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/apache/age"&gt;https://github.com/apache/age&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.interdb.jp/pg/index.html"&gt;https://www.interdb.jp/pg/index.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>apacheage</category>
      <category>database</category>
      <category>agedb</category>
      <category>postgres</category>
    </item>
    <item>
      <title>PostgreSQL Process Architecture</title>
      <dc:creator>Maruf13</dc:creator>
      <pubDate>Mon, 06 Mar 2023 23:00:26 +0000</pubDate>
      <link>https://dev.to/maruf13/postgresql-process-architecture-3o4g</link>
      <guid>https://dev.to/maruf13/postgresql-process-architecture-3o4g</guid>
      <description>&lt;p&gt;In this post, we will discuss the Process Architecture of PostgreSQL. PostgreSQL is a &lt;strong&gt;&lt;em&gt;client/server type&lt;/em&gt;&lt;/strong&gt; relational database management system(&lt;strong&gt;RDMS&lt;/strong&gt;) with the multi-process architecture and &lt;strong&gt;&lt;em&gt;runs on a single host&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;collection of multiple processes&lt;/strong&gt; cooperatively managing one database cluster is usually referred to as a &lt;strong&gt;&lt;em&gt;'PostgreSQL server'&lt;/em&gt;&lt;/strong&gt;, and its process tree will be show below figure: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdzx229nkauubyg0612og.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdzx229nkauubyg0612og.png" alt="Process Tree"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ Postgres server process:&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It is a parent of all processes related to a database cluster management. Previously, it was called &lt;strong&gt;‘postmaster’&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;By executing the &lt;strong&gt;&lt;em&gt;pg_ctl&lt;/em&gt;&lt;/strong&gt; utility with start option, a postgres server process &lt;strong&gt;starts up&lt;/strong&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fudmgeey7c28u0yhv7ohy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fudmgeey7c28u0yhv7ohy.png" alt="Postgres server process"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Then, it &lt;strong&gt;allocates a shared memory&lt;/strong&gt; area in memory, starts various background processes, starts replication associated processes and background worker processes if necessary, and &lt;em&gt;&lt;strong&gt;waits for connection&lt;/strong&gt;&lt;/em&gt; requests from clients. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;After receiving a connection request from a client, it &lt;strong&gt;&lt;em&gt;starts a backend process&lt;/em&gt;&lt;/strong&gt;. After that, Backend process handles all queries issued by the connected client.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A postgres server process work with one network port, the &lt;strong&gt;&lt;em&gt;default port is 5432&lt;/em&gt;&lt;/strong&gt;. Although more than one PostgreSQL server can be run on the same host, then port number can be set as 5432, 5433 etc.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ Backend process:&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A backend process, which is also called &lt;strong&gt;&lt;em&gt;postgres&lt;/em&gt;&lt;/strong&gt;, is started by the postgres server process and handles all queries issued by one connected client. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It communicates with the client by a &lt;strong&gt;single TCP connection&lt;/strong&gt;, and terminates when the client gets disconnected.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;As it is allowed to &lt;strong&gt;&lt;em&gt;operate only one database&lt;/em&gt;&lt;/strong&gt;, you have to specify a database you want to use explicitly when connecting to a PostgreSQL server.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;PostgreSQL allows multiple clients to connect simultaneously; the configuration parameter &lt;strong&gt;&lt;em&gt;max_connections&lt;/em&gt;&lt;/strong&gt; controls the maximum number of the clients (default is 100).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If &lt;strong&gt;many clients repeat&lt;/strong&gt; the connection and disconnection with a PostgreSQL server, it &lt;strong&gt;increases both costs of establishing connections&lt;/strong&gt; and of creating backend processes because PostgreSQL &lt;strong&gt;&lt;em&gt;has not implemented a native connection pooling feature&lt;/em&gt;&lt;/strong&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Such circumstance has a negative effect on the performance of database server. To deal with such a case, a &lt;em&gt;&lt;strong&gt;pooling middleware (either pgbouncer or pgpool-II)&lt;/strong&gt;&lt;/em&gt; is usually used.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ Background processes:&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Various background processes perform processes of each feature for database management. Below table shows a list of background processes. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flkqlbiok74uuze3s9fbq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flkqlbiok74uuze3s9fbq.png" alt="Background Process"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ Replication associated processes:&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In the replication associated processes, they perform the streaming replication. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In Streaming Replication, three kinds of processes work cooperatively. A &lt;strong&gt;&lt;em&gt;walsender process&lt;/em&gt;&lt;/strong&gt; on the primary server sends WAL data to standby server; and then, a &lt;strong&gt;&lt;em&gt;walreceiver&lt;/em&gt;&lt;/strong&gt; and a &lt;strong&gt;&lt;em&gt;startup&lt;/em&gt;&lt;/strong&gt; processes on standby server receives and replays these data. A walsender and a walreceiver communicate using a single TCP connection.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;✔️ Background worker process:&lt;/code&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;It can perform any processing &lt;strong&gt;&lt;em&gt;implemented by users&lt;/em&gt;&lt;/strong&gt; or to run user-supplied code in separate processes. Such processes are started, stopped and monitored by postgres, which permits them to have a &lt;strong&gt;&lt;em&gt;lifetime linked&lt;/em&gt;&lt;/strong&gt; to the server's status. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;These processes are attached to PostgreSQL's &lt;strong&gt;&lt;em&gt;shared memory area&lt;/em&gt;&lt;/strong&gt; and have the option to connect to databases internally; they can also run multiple transactions serially, just like a regular client-connected server process. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Background workers can be initialized at the time that PostgreSQL is started by including the module name in &lt;strong&gt;&lt;em&gt;shared_preload_libraries&lt;/em&gt;&lt;/strong&gt;. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A module wishing to run a background worker can register it by calling &lt;strong&gt;RegisterBackgroundWorker(BackgroundWorker *worker)&lt;/strong&gt; from its &lt;strong&gt;_&lt;em&gt;PG_init()&lt;/em&gt;&lt;/strong&gt; function. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Background workers can also be started after the system is up and running by calling &lt;em&gt;&lt;strong&gt;RegisterDynamicBackgroundWorker&lt;/strong&gt;&lt;/em&gt; function. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the following figure, the details of the first three types of processes are shown:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fthnrmxw3prvyunee22n5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fthnrmxw3prvyunee22n5.png" alt="Details"&gt;&lt;/a&gt;&lt;br&gt;
The actual processes of a PostgreSQL server is shown below. In the following example, one postgres server process (pid is 9687), two backend processes (pids are 9697 and 9717) and the several background processes listed here:&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&lt;p&gt;postgres&amp;gt; pstree -p 9687&lt;br&gt;
-+= 00001 root /sbin/launchd&lt;br&gt;
 -+- 09687 postgres /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data&lt;br&gt;
   |--= 09688 postgres postgres: logger process&lt;br&gt;&lt;br&gt;
   |--= 09690 postgres postgres: checkpointer process&lt;br&gt;&lt;br&gt;
   |--= 09691 postgres postgres: writer process&lt;br&gt;&lt;br&gt;
   |--= 09692 postgres postgres: wal writer process&lt;br&gt;&lt;br&gt;
   |--= 09693 postgres postgres: autovacuum launcher process&lt;br&gt;&lt;br&gt;
   |--= 09694 postgres postgres: archiver process&lt;br&gt;&lt;br&gt;
   |--= 09695 postgres postgres: stats collector process&lt;br&gt;&lt;br&gt;
   |--= 09697 postgres postgres: postgres sampledb 192.168.1.100(54924) idle&lt;br&gt;&lt;br&gt;
   --= 09717 postgres postgres: postgres sampledb 192.168.1.100(54964) idle in transaction  &lt;/p&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  &lt;code&gt;✔️ References:&lt;/code&gt;&lt;br&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://age.apache.org/" rel="noopener noreferrer"&gt;https://age.apache.org/&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/apache/age" rel="noopener noreferrer"&gt;https://github.com/apache/age&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.interdb.jp/pg/index.html" rel="noopener noreferrer"&gt;https://www.interdb.jp/pg/index.html&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>apacheage</category>
      <category>database</category>
      <category>postgres</category>
      <category>agedb</category>
    </item>
    <item>
      <title>Easy Installation of PostgreSQL, AGE &amp; Age-viewer on Mac</title>
      <dc:creator>Maruf13</dc:creator>
      <pubDate>Sat, 25 Feb 2023 19:04:39 +0000</pubDate>
      <link>https://dev.to/maruf13/installation-of-postgresql-age-on-mac-4gc9</link>
      <guid>https://dev.to/maruf13/installation-of-postgresql-age-on-mac-4gc9</guid>
      <description>&lt;p&gt;Follow below steps to install age correctly on macbook pro m1 or any other mac:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Create a folder where you want to store all source code. In this folder, you need 3 source code such as: (i) postgresql version 11/12 source code (ii) age source code (iii) age-viewer source code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;(i) download postgresql from this &lt;a href="https://www.postgresql.org/ftp/source/v11.17/"&gt;link&lt;/a&gt; and store it on that folder.&lt;br&gt;
(ii) download age from this &lt;a href="https://github.com/apache/age"&gt;link&lt;/a&gt; and store on that folder&lt;br&gt;
(iii) download age-viewer from this &lt;a href="https://github.com/apache/age-viewer"&gt;link&lt;/a&gt; and store on that same folder.&lt;br&gt;
goto postgresql folder &amp;amp; open terminal on it &amp;amp; run command like as:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./configure --enable-debug --enable-cassert --prefix=$(pwd) CFLAGS="-glldb -ggdb -Og -g3 -fno-omit-frame-pointer"
make install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;those are the two command to install postgresql.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
after that goto age folder &amp;amp; open terminal on it &amp;amp; run command like as:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo make PG_CONFIG=~/Your_base_folder_path/postgresql/bin/pg_config install
make PG_CONFIG=~/Your_base_folder_path/postgresql/bin/pg_config installcheck
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
goto postgresql folder &amp;amp; open terminal on it &amp;amp; run command like as:&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;bin/initdb demo&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
goto demo folder inside postgresql folder and open postgresql.conf file &amp;amp; we need add three words here such as:&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;port = 5432 /remove # from port number/&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#search_path = 'ag_catalog,"$user", public' // addding 'ag_catalog' to this path&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#shared_preload_libraries = 'age' //add age in inverted commas.&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
Now start the server and make a database named demodb&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;ol&gt;
&lt;li&gt;&lt;code&gt;bin/pg_ctl -D demo -l logfile start&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;bin/createdb demodb&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
AGE added to postgresql successfully. Now we can enter in to pg_sql console to start testing.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;bin/psql demodb&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;thats the process.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To install age-viewer, goto age-viewer folder and open terminal &amp;amp; run below command:&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;npm run setup&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm run start&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;then fill up the connection data like below:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;url: localhost;

port: 5430;

username: sakibadnan; //use your username

# radom pass as password is not set for this user.
pass: 1234;

dbname: demodb;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--22GDb-L8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p2s3yx99qro42vtv5hfc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--22GDb-L8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p2s3yx99qro42vtv5hfc.png" alt="installation" width="880" height="525"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;References:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://age.apache.org/"&gt;https://age.apache.org/&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/apache/age"&gt;https://github.com/apache/age&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/apache/age-viewer"&gt;https://github.com/apache/age-viewer&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>apacheage</category>
      <category>postgres</category>
      <category>agensgraph</category>
      <category>age</category>
    </item>
  </channel>
</rss>
