<?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>Forem: mohayu22</title>
    <description>The latest articles on Forem by mohayu22 (@mohayu22).</description>
    <link>https://forem.com/mohayu22</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%2F1031574%2F018f5676-0af9-41e5-82d1-c1e435c47393.png</url>
      <title>Forem: mohayu22</title>
      <link>https://forem.com/mohayu22</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mohayu22"/>
    <language>en</language>
    <item>
      <title>Use postgreSQL native functions inside cypher query (AGE)</title>
      <dc:creator>mohayu22</dc:creator>
      <pubDate>Thu, 15 Jun 2023 09:51:02 +0000</pubDate>
      <link>https://forem.com/mohayu22/use-postgresql-native-functions-inside-cypher-query-age-3adn</link>
      <guid>https://forem.com/mohayu22/use-postgresql-native-functions-inside-cypher-query-age-3adn</guid>
      <description>&lt;p&gt;Although there are numerous helpful functions available in PostgreSQL that you might want to utilize in your project, they cannot be directly used in a Cypher query.&lt;/p&gt;

&lt;p&gt;To incorporate PostgreSQL's functions within a Cypher query, one approach is to create wrapper functions in AGE. These wrapper functions should be prefixed with &lt;code&gt;age_&lt;/code&gt; when writing C code. However, when using these functions in a Cypher query, there's no need to include the prefix.&lt;/p&gt;

&lt;p&gt;To invoke the desired PostgreSQL function within the wrapper function, you can employ the &lt;code&gt;DirectFunctionCallX&lt;/code&gt; macro. Remember to include the file where the function is located to ensure proper compilation and execution.&lt;/p&gt;

</description>
      <category>apacheage</category>
      <category>postgres</category>
    </item>
    <item>
      <title>How to run driver tests for Apache Age</title>
      <dc:creator>mohayu22</dc:creator>
      <pubDate>Wed, 03 May 2023 15:22:58 +0000</pubDate>
      <link>https://forem.com/mohayu22/how-to-run-driver-tests-for-apache-age-5g80</link>
      <guid>https://forem.com/mohayu22/how-to-run-driver-tests-for-apache-age-5g80</guid>
      <description>&lt;p&gt;When you make some changes to Apache AGE code, it's important to check if those changes are causing errors. You can do this using AGE's &lt;code&gt;installcheck&lt;/code&gt; command, which runs regression tests. &lt;/p&gt;

&lt;p&gt;However, AGE also has four drivers (Go, NodeJS, Python, and JDBC) with their individual tests, and testing them can be a tedious process. You need to go to each driver's folder, find the &lt;code&gt;README.md&lt;/code&gt; file, follow the instructions, download dependencies, and run the appropriate commands.&lt;/p&gt;

&lt;p&gt;Fortunately, there's an easier way to test these drivers using Github Workflows. &lt;/p&gt;

&lt;p&gt;Follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fork the Apache Age repository to your Github account.&lt;/li&gt;
&lt;li&gt;Make any changes you want and push them to a separate branch of your fork.&lt;/li&gt;
&lt;li&gt;Change the '.yml' files in &lt;code&gt;.github/workflows&lt;/code&gt; folder. Each file has the following code:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; on:
 push:
 branches: ["master", "PG11"]
 pull_request:
 branches: ["master", "PG11"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remove &lt;code&gt;"PG11"&lt;/code&gt; from these lines.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Submit a pull request to the master branch of your fork.&lt;/li&gt;
&lt;li&gt;You can now run all the tests by going to the Checks tab on your Github account.&lt;/li&gt;
&lt;li&gt;After verifying that all the results are accurate, remove the commits you made in the &lt;code&gt;.github/workflows&lt;/code&gt; folder. Alternatively, delete the pull request and branch, create a new branch and push the changes but do not modify the &lt;code&gt;.github/workflows&lt;/code&gt; files this time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By following these steps, you can easily test the AGE drivers and ensure that your changes don't cause any errors. This method saves you time and effort compared to manually testing each driver.&lt;/p&gt;

</description>
      <category>apacheage</category>
    </item>
    <item>
      <title>PostgreSQL Query Optimization Tips and Tricks</title>
      <dc:creator>mohayu22</dc:creator>
      <pubDate>Thu, 23 Feb 2023 12:40:30 +0000</pubDate>
      <link>https://forem.com/mohayu22/postgresql-query-optimization-tips-and-tricks-163a</link>
      <guid>https://forem.com/mohayu22/postgresql-query-optimization-tips-and-tricks-163a</guid>
      <description>&lt;p&gt;PostgreSQL query optimization refers to the process of improving the performance and efficiency of SQL queries executed on a PostgreSQL database. It involves analyzing and adjusting various components of the database system, including the query planner, indexing, caching, and server configuration.&lt;/p&gt;

&lt;p&gt;Here are some techniques and best practices for optimizing PostgreSQL queries:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EXPLAIN Command:&lt;/strong&gt; &lt;br&gt;
Use the EXPLAIN command to analyze query execution plans and identify potential performance bottlenecks. This command shows how the query is being executed and provides information about the indexes, join algorithms, and sort operations used.&lt;br&gt;
&lt;a href="https://media2.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%2Fwzdbzbpte9cixj5akbsj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fwzdbzbpte9cixj5akbsj.png" alt=" " width="691" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Indexes:&lt;/strong&gt; &lt;br&gt;
Use indexes to speed up query execution. Indexes allow PostgreSQL to find data more quickly by creating a separate data structure that can be searched efficiently. Choosing the right indexes can significantly improve query performance.The following indexes can be implemented in PostgreSQL:&lt;br&gt;
&lt;strong&gt;1.&lt;/strong&gt; B-tree Index (default)&lt;br&gt;
&lt;strong&gt;2.&lt;/strong&gt; Hash Index&lt;br&gt;
&lt;strong&gt;3.&lt;/strong&gt; GiST (Generalized Search Tree) Index&lt;br&gt;
&lt;strong&gt;4.&lt;/strong&gt; SP-GiST (Space Partitioned Generalized Search Tree) Index&lt;br&gt;
&lt;strong&gt;5.&lt;/strong&gt; GIN (Generalized Inverted Index) Index&lt;br&gt;
&lt;strong&gt;6.&lt;/strong&gt; BRIN (Block Range INdex) Index&lt;br&gt;
&lt;strong&gt;7.&lt;/strong&gt; Bitmap Index&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Functions:&lt;/strong&gt; &lt;br&gt;
Avoid using functions in WHERE clauses or JOIN conditions,as they can prevent the use of indexes and slow down queries. If possible, move the function call to the SELECT clause.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prepared Statements:&lt;/strong&gt;&lt;br&gt;
Use prepared statements to avoid re-parsing queries each time they are executed. This can improve performance and reduce server load.&lt;/p&gt;

&lt;p&gt;A prepared statement is a server-side object that can be used to optimize performance. When the PREPARE statement is executed, the specified statement is parsed, analyzed, and rewritten. When an EXECUTE command is subsequently issued, the prepared statement is planned and executed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Partitioning:&lt;/strong&gt; &lt;br&gt;
Consider using partitioning to divide large tables into smaller, more manageable pieces. This can speed up queries that only need to access a subset of the data. The following forms of partitioning can be implemented in PostgreSQL:&lt;br&gt;
&lt;strong&gt;1.&lt;/strong&gt; Range Partitioning&lt;br&gt;
&lt;strong&gt;2.&lt;/strong&gt; List Partitioning&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configuration:&lt;/strong&gt;&lt;br&gt;
Adjust PostgreSQL server configuration settings, such as the shared_buffers and work_mem parameters, to optimize performance for your specific workload.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tools:&lt;/strong&gt;&lt;br&gt;
Use query optimization tools and frameworks, such as pgAdmin, to automate the process of analyzing and optimizing queries. These tools can suggest improvements and provide detailed performance metrics.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;BONUS:&lt;/strong&gt;&lt;br&gt;
Apache AGE is a PostgreSQL extension that provides graph database functionality. The goal of Apache AGE is to provide graph data processing and analytics capability to all relational databases. Through Apache AGE, PostgreSQL users will gain access to graph query modeling within the existing relational database. Users can read and write graph data in nodes and edges. They can also use various algorithms such as variable length and edge traversal when analyzing data. &lt;br&gt;
&lt;strong&gt;Website:&lt;/strong&gt; &lt;a href="https://age.apache.org/" rel="noopener noreferrer"&gt;https://age.apache.org/&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Github:&lt;/strong&gt; &lt;a href="https://github.com/apache/age" rel="noopener noreferrer"&gt;https://github.com/apache/age&lt;/a&gt;&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
  </channel>
</rss>
