<?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: Ahmed Mohamed</title>
    <description>The latest articles on DEV Community by Ahmed Mohamed (@ahmedmohamed).</description>
    <link>https://dev.to/ahmedmohamed</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%2F1062628%2F2836d791-89d7-4e55-aab5-9f0d33ea1498.png</url>
      <title>DEV Community: Ahmed Mohamed</title>
      <link>https://dev.to/ahmedmohamed</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahmedmohamed"/>
    <language>en</language>
    <item>
      <title>Migrating Schema from MongoDB to PostgreSQL: A Practical Example</title>
      <dc:creator>Ahmed Mohamed</dc:creator>
      <pubDate>Mon, 28 Aug 2023 21:06:16 +0000</pubDate>
      <link>https://dev.to/ahmedmohamed/migrating-schema-from-mongodb-to-postgresql-a-practical-example-52lk</link>
      <guid>https://dev.to/ahmedmohamed/migrating-schema-from-mongodb-to-postgresql-a-practical-example-52lk</guid>
      <description>&lt;p&gt;Database migrations aren't just for upgrading databases inside the same system. They are also essential when switching between different database systems. We'll walk through the process of converting a schema from MongoDB to PostgreSQL using Python and related modules in this.&lt;br&gt;
The following is just a quick example to know the idea.&lt;/p&gt;
&lt;h2&gt;
  
  
  Understanding the Scenario
&lt;/h2&gt;

&lt;p&gt;Assume you're working on a social networking platform that allows users to send messages. The data was originally stored in a MongoDB database, but you've decided to migrate it to PostgreSQL for better querying and scalability. The user messages and associated data will be moved from MongoDB to PostgreSQL.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 1: Install Required Libraries
&lt;/h3&gt;

&lt;p&gt;Make sure you have the necessary libraries installed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;pip&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;pymongo&lt;/span&gt; &lt;span class="n"&gt;psycopg2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Fetch Data from MongoDB
&lt;/h3&gt;

&lt;p&gt;Use the &lt;code&gt;pymongo&lt;/code&gt; library to connect to the MongoDB database and retrieve the data you want to migrate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;pymongo&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;MongoClient&lt;/span&gt;

&lt;span class="c1"&gt;# Connect to MongoDB
&lt;/span&gt;&lt;span class="n"&gt;mongo_client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;MongoClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"mongodb://localhost:27017/"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;mongo_db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mongo_client&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"social_media_db"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;mongo_messages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mongo_db&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"messages"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# Fetch messages
&lt;/span&gt;&lt;span class="n"&gt;messages_to_migrate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mongo_messages&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;find&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Set Up PostgreSQL Connection
&lt;/h3&gt;

&lt;p&gt;Create a PostgreSQL database and set up the schema to match the MongoDB data. Use the &lt;code&gt;psycopg2&lt;/code&gt; library to connect to the PostgreSQL database and insert data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;psycopg2&lt;/span&gt;

&lt;span class="c1"&gt;# Connect to PostgreSQL
&lt;/span&gt;&lt;span class="n"&gt;conn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;psycopg2&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"localhost"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;database&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"social_media_db"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"your_username"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;password&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"your_password"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;cur&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Create schema in PostgreSQL if not already done
&lt;/span&gt;&lt;span class="n"&gt;create_schema_query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"""
CREATE TABLE IF NOT EXISTS messages (
    id SERIAL PRIMARY KEY,
    user_id INTEGER,
    content TEXT
);
"""&lt;/span&gt;
&lt;span class="n"&gt;cur&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;create_schema_query&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;commit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Insert migrated messages
&lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;messages_to_migrate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;insert_query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s"&gt;"INSERT INTO messages (user_id, content) VALUES (%s, %s);"&lt;/span&gt;
    &lt;span class="n"&gt;cur&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;insert_query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"user_id"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;]))&lt;/span&gt;
    &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;commit&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Close connections
&lt;/span&gt;&lt;span class="n"&gt;cur&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Data Transformation (Optional)
&lt;/h3&gt;

&lt;p&gt;If data types or structures between MongoDB and PostgreSQL are different, you might need to transform the data before insertion.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Testing and Verification
&lt;/h3&gt;

&lt;p&gt;Before using the new PostgreSQL-based system, thoroughly test the migrated data to ensure accuracy and data integrity.&lt;/p&gt;

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

&lt;p&gt;Migrating schema and data between database systems is a difficult operation that needs meticulous planning, data transformation, and validation. In this example, we used Python and the pymongo and &lt;code&gt;psycopg2&lt;/code&gt; modules to convert user messages from MongoDB to PostgreSQL. Data is retrieved from the source database, the destination schema is configured, and data is transformed and inserted into the target database. Database migration between different systems can be accomplished successfully with careful planning and execution, allowing enterprises to capitalize on the capabilities of each database platform.&lt;/p&gt;

</description>
      <category>postgres</category>
    </item>
    <item>
      <title>Navigating the Landscape of Database Migration: Benefits and Best Practices</title>
      <dc:creator>Ahmed Mohamed</dc:creator>
      <pubDate>Mon, 28 Aug 2023 21:04:41 +0000</pubDate>
      <link>https://dev.to/ahmedmohamed/navigating-the-landscape-of-database-migration-benefits-and-best-practices-31ka</link>
      <guid>https://dev.to/ahmedmohamed/navigating-the-landscape-of-database-migration-benefits-and-best-practices-31ka</guid>
      <description>&lt;p&gt;Data management is critical in the ever-changing world of software development. The need to rearrange or relocate data between storage systems emerges when applications develop and evolve. This is where the idea of database migration comes in. In this detailed blog post, we'll go through what database migration is, why it's important, and the recommended practices for successful migrations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Database Migration
&lt;/h2&gt;

&lt;p&gt;The process of transferring data and schema objects from one database system to another is referred to as database migration. This procedure entails transporting data, preserving data integrity, changing data to conform to the new schema, and ensuring that the application continues to function normally after the migration.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use Database Migration?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Platform Upgrades: Migrating to a new version of a database system guarantees that data is compatible with the new features and optimizations, which improves performance and security.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Switching Database Vendors: If your organization decides to transfer to a different database provider, migration allows you to port your data and applications without having to completely rebuild them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Datacenter Relocation: Database migration is used during datacenter migrations to move data from one location to another without impacting business operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scaling: Scalability is ensured by migrating data to a more resilient database system, which can manage increasing data volumes and user demands.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cloud Adoption: Migration ensures that your data is securely and efficiently transferred to the cloud-based database when transferring to the cloud.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Benefits of Database Migration
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Performance Improvement: Migrating to a more optimized database system can enhance query performance and overall application responsiveness dramatically.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cost Efficiency: Migration to open-source or cloud-based databases can save money on licensing and operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scalability: Migrating to a more scalable system allows you to successfully handle increased data loads and user traffic.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Security: Database migrations frequently involve upgrading to systems with improved security measures, which better secure critical data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;New Features: Migrations enable you to take advantage of new features and advancements provided by modern database systems.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Best Practices for Successful Database Migration
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Planning: A well-defined migration strategy describes the scope, goals, dates, and resources needed for a successful migration.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Analysis: Before designing your migration approach, properly analyze your data to understand its structure, dependencies, and linkages.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Testing: Run extensive tests on a dummy production environment to discover potential issues and confirm the migration procedure.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Backup and Rollback strategy: Make backups of your data before migrating, and have a backup strategy in place in case of unanticipated complications.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Transformation: Ensure that data is accurately transformed and mapped to match the new schema, while maintaining data integrity.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Communication: To minimize disruptions, keep stakeholders informed about the relocation process and anticipated downtimes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Monitoring and Optimization: After the migration is complete, monitor the moved system and optimize queries or configurations.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>postgres</category>
    </item>
    <item>
      <title>Leveraging PostgreSQL Full Text Search for Enhanced Content Discovery in Content Management Systems</title>
      <dc:creator>Ahmed Mohamed</dc:creator>
      <pubDate>Mon, 28 Aug 2023 21:02:53 +0000</pubDate>
      <link>https://dev.to/ahmedmohamed/leveraging-postgresql-full-text-search-for-enhanced-content-discovery-in-content-management-systems-1m11</link>
      <guid>https://dev.to/ahmedmohamed/leveraging-postgresql-full-text-search-for-enhanced-content-discovery-in-content-management-systems-1m11</guid>
      <description>&lt;p&gt;CMS (information Management Systems) have become essential for properly managing and delivering digital information. However, as the volume of content expands, it might be difficult to identify useful information. PostgreSQL's Full Text Search (FTS) features shine here. In this post, we'll look at how PostgreSQL FTS may be used to provide robust search capabilities within CMS platforms.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example Scenario: Building a Blog Post Search
&lt;/h2&gt;

&lt;p&gt;Consider a CMS that hosts a large number of blog articles. Traditional searches may focus on exact keyword matches, ignoring content that use similar phrases or synonyms. Let's have a look at how PostgreSQL FTS can enhance the search experience:&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Creating a Full Text Search Index
&lt;/h3&gt;

&lt;p&gt;To get started, create a full-text search index on the relevant columns of your database table. In this case, we'll index the title and content columns of the blog_posts table:&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;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;blog_posts_fts_idx&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;blog_posts&lt;/span&gt;
&lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="n"&gt;gin&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;to_tsvector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Implementing FTS Queries
&lt;/h3&gt;

&lt;p&gt;Now, let's explore various FTS queries to enhance content discovery:&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Basic Text Search:
&lt;/h4&gt;

&lt;p&gt;Retrieve all blog posts containing the word "technology":&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;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;blog_posts&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;to_tsvector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;@@&lt;/span&gt; &lt;span class="n"&gt;to_tsquery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'technology'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

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

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Ranking Results:
&lt;/h4&gt;

&lt;p&gt;Rank the results by relevance using the ts_rank function:&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;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ts_rank&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;to_tsvector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;to_tsquery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'technology'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;rank&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;blog_posts&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;to_tsvector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;@@&lt;/span&gt; &lt;span class="n"&gt;to_tsquery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'technology'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="n"&gt;rank&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  3. Phrase Search:
&lt;/h4&gt;

&lt;p&gt;Search for blog posts containing the phrase "machine learning":&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;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;blog_posts&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;to_tsvector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;@@&lt;/span&gt; &lt;span class="n"&gt;phraseto_tsquery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'machine learning'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  4. Synonyms and Stemming:
&lt;/h4&gt;

&lt;p&gt;Consider synonyms and stemming for a broader search:&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;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;blog_posts&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;to_tsvector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;@@&lt;/span&gt; &lt;span class="n"&gt;to_tsquery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'analyzing | analysing'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  5. Highlighting Matched Words:
&lt;/h4&gt;

&lt;p&gt;Highlight matched words using the ts_headline function:&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;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ts_headline&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;to_tsquery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'database'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;highlighted_text&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;blog_posts&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;to_tsvector&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;title&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="s1"&gt;' '&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;@@&lt;/span&gt; &lt;span class="n"&gt;to_tsquery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'english'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'database'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>postgres</category>
    </item>
    <item>
      <title>Harnessing the Power of PostgreSQL Full Text Search: Examples and Applications</title>
      <dc:creator>Ahmed Mohamed</dc:creator>
      <pubDate>Mon, 28 Aug 2023 21:01:23 +0000</pubDate>
      <link>https://dev.to/ahmedmohamed/harnessing-the-power-of-postgresql-full-text-search-examples-and-applications-1a1n</link>
      <guid>https://dev.to/ahmedmohamed/harnessing-the-power-of-postgresql-full-text-search-examples-and-applications-1a1n</guid>
      <description>&lt;p&gt;Before we go into the examples, let's first define PostgreSQL Full Text Search. FTS examines and processes text data to extract useful results based on linguistic and semantic patterns, as opposed to simple string matching, which only discovers precise matches. This makes it perfect for situations in which users need to search for specific words or phrases inside unstructured or semi-structured text data.&lt;/p&gt;

&lt;p&gt;Inverted indexing is a technique used by PostgreSQL FTS in which each unique word (or token) inside the indexed text is associated with a list of locations where it appears. This allows for speedier search queries and more accurate search result ranking.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example 1: E-Commerce Search
&lt;/h2&gt;

&lt;p&gt;E-commerce platforms are one of the most common places where PostgreSQL Full Text Search is used. Consider a user who is looking for a certain product in a huge inventory. If the user's query is even slightly different from the product name, traditional exact-match searches may miss relevant listings. FTS allows the search algorithm to consider synonyms, misspellings, and wording variants.&lt;/p&gt;

&lt;p&gt;For example, if a user searches for "comfortable running shoes," the FTS system may offer results such as "running sneakers for comfort" or "best shoes for jogging." This amount of search versatility improves the user experience and increases the possibility of sales.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example 2: Content Management Systems
&lt;/h2&gt;

&lt;p&gt;PostgreSQL FTS is extremely useful in content-heavy applications like as content management systems (CMS) or blogging platforms. More than just matching keywords is required when searching through a large collection of articles, blog posts, or documents. FTS provides powerful search capabilities such as:&lt;/p&gt;

&lt;p&gt;FTS may rank search results based on relevance, taking into account characteristics such as keyword frequency, position, and proximity.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Phrasal Search: Users can search for exact phrases even if the words in the text are not nearby.
FTS understands word variations and synonyms, resulting in complete results.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This feature enables users to find relevant content fast, enabling effective information retrieval.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example 3: Social Media Platforms
&lt;/h2&gt;

&lt;p&gt;From posts and comments to hashtags and user profiles, social media platforms are constantly bombarded with text-based material. Implementing PostgreSQL FTS improves the search experience by allowing for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Hashtag Searches: Even if the precise hashtag is not used, users can search content related with specific hashtags.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;User Search: Searching for users becomes more flexible, taking into account usernames, real names, and even misspellings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Trending Topics: FTS can help find trending topics by analyzing frequently used terms.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Example 4: Job Portals
&lt;/h2&gt;

&lt;p&gt;To match job seekers with appropriate positions, employment portals must have accurate and efficient search capabilities. PostgreSQL FTS can improve job search functionality by doing the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Location-Based Search: Job seekers can search for vacancies based on their location or closeness to a specific area.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Skill Matching: FTS can find and prioritize job advertisements that match a candidate's abilities and qualifications.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Industry Jargon and Specific Keywords: Industry jargon and specific keywords are recognized, resulting in more exact search results.&lt;br&gt;
This guarantees that job seekers find employment that are a good fit for their skills and preferences.&lt;/p&gt;

</description>
      <category>postgres</category>
    </item>
    <item>
      <title>Unleashing the Benefits: Why Embrace PostgreSQL Full Text Search</title>
      <dc:creator>Ahmed Mohamed</dc:creator>
      <pubDate>Mon, 28 Aug 2023 20:58:11 +0000</pubDate>
      <link>https://dev.to/ahmedmohamed/unleashing-the-benefits-why-embrace-postgresql-full-text-search-3d3b</link>
      <guid>https://dev.to/ahmedmohamed/unleashing-the-benefits-why-embrace-postgresql-full-text-search-3d3b</guid>
      <description>&lt;p&gt;PostgreSQL has proven to be a strong database system in the field of modern data management, acclaimed for its versatility and broad feature set. PostgreSQL Full Text Search (FTS) stands out as a fantastic tool for unleashing the entire potential of text-based data exploration among its features. This article explores the compelling reasons to use PostgreSQL FTS, emphasizing its benefits and real-world applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding PostgreSQL Full Text Search
&lt;/h2&gt;

&lt;p&gt;Before we get into the benefits, let's go through what PostgreSQL Full Text Search is. FTS uses linguistic and semantic analysis to give contextually relevant search results, as opposed to traditional database search approaches that focus on exact word matching. This means that, rather than merely looking for a keyword, FTS takes into account word variants, synonyms, and word proximity to provide a more comprehensive and accurate search experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advantages of PostgreSQL Full Text Search
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Flexible Search Capabilities:
&lt;/h2&gt;

&lt;p&gt;PostgreSQL FTS takes into account the intricacies of human language. Users can search for synonyms, similar terms, and even misspellings, allowing them to find content that might otherwise go unnoticed with typical searches.&lt;/p&gt;

&lt;h3&gt;
  
  
  Ranking and Relevance:
&lt;/h3&gt;

&lt;p&gt;FTS presents a ranking algorithm that ranks search results depending on their relevance. This means that users will get the most relevant content at the front of their search results, which will improve the user experience.&lt;/p&gt;

&lt;h3&gt;
  
  
  Support for Complex Queries:
&lt;/h3&gt;

&lt;p&gt;Advanced query options supported by FTS include phrase searches, boolean operators (AND, OR, NOT), proximity searches, and wildcard searches. This enables users to construct complex searches that capture unique needs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Efficiency and Performance:
&lt;/h3&gt;

&lt;p&gt;The underlying indexing methods of PostgreSQL allow FTS to provide speedy search results even in databases with millions of records. Inverted indexing dramatically reduces search times while maintaining good performance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Language Support:
&lt;/h3&gt;

&lt;p&gt;FTS is not restricted to English; it supports a diverse range of languages, enabling global applications without sacrificing accuracy.&lt;/p&gt;

&lt;h3&gt;
  
  
  Integration with Other PostgreSQL Features:
&lt;/h3&gt;

&lt;p&gt;PostgreSQL FTS works in tandem with other PostgreSQL functionalities. Combining FTS with normal SQL queries ensures consistency while also simplifies your development process.&lt;/p&gt;

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

&lt;p&gt;PostgreSQL Full Text Search is an amazing tool that completely changes the way we interact with text-based data. Its ability to understand language semantics and give contextually appropriate results enables organizations to design user-friendly search experiences. PostgreSQL FTS plays a critical role in enabling data exploration, boosting engagement, and ultimately contributing to the success of a wide range of applications, from e-commerce to CMS and beyond. Adopting PostgreSQL FTS is a strategic move that may propel your data-driven initiatives to new heights.&lt;/p&gt;

</description>
      <category>postgres</category>
    </item>
    <item>
      <title>Installing EDB Postgres Advanced Server on Ubuntu 22.04</title>
      <dc:creator>Ahmed Mohamed</dc:creator>
      <pubDate>Fri, 14 Jul 2023 18:03:12 +0000</pubDate>
      <link>https://dev.to/ahmedmohamed/installing-edb-postgres-advanced-server-on-ubuntu-2204-2b6</link>
      <guid>https://dev.to/ahmedmohamed/installing-edb-postgres-advanced-server-on-ubuntu-2204-2b6</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;EDB EnterpriseDB is a robust and feature-rich open-source database management system (DBMS) built upon PostgreSQL. If you're considering leveraging EDB EnterpriseDB for your Linux environment, this step-by-step guide will walk you through the installation process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation steps
&lt;/h2&gt;

&lt;p&gt;update your package manager&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;. Set up the EDB repository&lt;br&gt;
Setting up the repository is a one-time task. If you have already set up your repository, you don't need to perform this step.&lt;/p&gt;

&lt;p&gt;To determine if your repository exists, enter this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;apt-cache search enterprisedb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If no output is generated, the repository isn't installed.&lt;/p&gt;

&lt;p&gt;To set up the EDB repository:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;a href="https://www.enterprisedb.com/repos-downloads"&gt;EDB repositories&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Select the button that provides access to the EDB repo.&lt;/li&gt;
&lt;li&gt;Select the platform and software that you want to download.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Install the package&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nb"&gt;install &lt;/span&gt;edb-as&amp;lt;xx&amp;gt;-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where &lt;code&gt;&amp;lt;xx&amp;gt;&lt;/code&gt; is the version of the EDB Postgres Advanced server you are installing. For example, if you are installing version 15, the package name would be &lt;code&gt;edb-as15-server&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To install an individual component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt-get &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nb"&gt;install&lt;/span&gt; &amp;lt;package_name&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Initial configuration
&lt;/h2&gt;

&lt;p&gt;This section steps you through getting started with your cluster including logging in, ensuring the installation was successful, connecting to your cluster, and creating the user password.&lt;/p&gt;

&lt;p&gt;To work in your cluster, login as the enterprisedb user. Connect to the database server using the psql command line client (although you can use a client of your choice with the appropriate connection string).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;su - enterprisedb

psql edb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server runs with the peer or ident permission by default. You can change the authentication method by modifying the pg_hba.conf file.&lt;/p&gt;

&lt;p&gt;Before changing the authentication method, assign a password to the database superuser, enterprisedb. For more information on changing the authentication, &lt;a href="https://www.enterprisedb.com/docs/epas/latest/database_administration/01_configuration_parameters/01_setting_new_parameters/#modifying-the-pg_hbaconf-file"&gt;see modifying the pg_hba.conf file&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ALTER ROLE enterprisedb IDENTIFIED BY password&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ref:&lt;br&gt;
&lt;a href="https://www.enterprisedb.com/docs/"&gt;EDB DOCs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>edb</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Unlocking the power of full-text search in PostgreSQL</title>
      <dc:creator>Ahmed Mohamed</dc:creator>
      <pubDate>Fri, 14 Jul 2023 18:02:45 +0000</pubDate>
      <link>https://dev.to/ahmedmohamed/unlocking-the-power-of-full-text-search-in-postgresql-2g4m</link>
      <guid>https://dev.to/ahmedmohamed/unlocking-the-power-of-full-text-search-in-postgresql-2g4m</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;PostgreSQL, one of the most popular open source relational database management systems, provides powerful and feature-rich full-text search. With PostgreSQL full-text search, businesses can improve the search experience by enabling complex text searches, ranking results by relevance, and implementing advanced language features. In this blog post, we will explore the power and potential of full-text search in PostgreSQL.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Full Text Search
&lt;/h2&gt;

&lt;p&gt;Full-text search goes beyond simple pattern matching and allows users to search large volumes of text efficiently. PostgreSQL's full-text search offers several key features, including native search, ranking, phrase search, and support for multiple languages. Native search helps match different forms of the same word, ranking assigns points to search results based on relevance, and phrase search helps find exact terms. In addition, PostgreSQL full-text search supports advanced language features such as thesaurus and stopword lists, improving the accuracy and precision of search results.&lt;/p&gt;

&lt;h2&gt;
  
  
  Set up full-text search
&lt;/h2&gt;

&lt;p&gt;To start using full-text search in PostgreSQL, the database must be configured correctly. First, make sure that the text search profile is installed and available. Then define a full-text search index on the desired column(s) of the table containing the text data. Indexes can be created using the &lt;code&gt;tsvector&lt;/code&gt; and &lt;code&gt;tsquery&lt;/code&gt; data types. Once the index is in place, queries can be created using the &lt;code&gt;@@&lt;/code&gt; operator to perform a full-text search on the indexed data. &lt;/p&gt;

&lt;h2&gt;
  
  
  Do a full-text search
&lt;/h2&gt;

&lt;p&gt;PostgreSQL provides a wide range of operators and functions for building powerful full-text search queries. These include &lt;code&gt;@@&lt;/code&gt; to match text to a query, &lt;code&gt;@@plainto_tsquery&lt;/code&gt; to generate a query from plain text, and &lt;code&gt;@@to_tsquery&lt;/code&gt; to generate a query from a sentence. In addition, PostgreSQL allows the use of Boolean operators (&lt;code&gt;AND&lt;/code&gt;, &lt;code&gt;OR&lt;/code&gt;, &lt;code&gt;NOT&lt;/code&gt;) to combine search conditions and further refine the results. By leveraging these operators and functions, enterprises can implement sophisticated and precise full-text search  to meet the diverse needs of users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Full-text search optimization
&lt;/h2&gt;

&lt;p&gt;To ensure optimal performance, PostgreSQL provides various configuration options to fine-tune full-text search. These options include modifying the search ranking algorithm, adjusting the default dictionary, and customizing the original list and stopwords. In addition, PostgreSQL allows the creation of custom dictionaries and attachments for specific languages ​​or domains. By fine-tuning these parameters, businesses can optimize  full-text search  to suit their specific needs and improve search accuracy, relevance, and performance.&lt;/p&gt;

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

&lt;p&gt;PostgreSQL's full-text search capability is a powerful feature that enables companies to implement advanced text retrieval and search functionality. By leveraging features like native generation, ratings, and language support, organizations can improve the search experience, deliver more accurate results, and unlock valuable insights from data. documents are stored in their database. PostgreSQL.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.postgresql.org/docs/14/textsearch.html"&gt;PostgreSql DOCs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>postgres</category>
    </item>
    <item>
      <title>Unleashing the Potential of EDB EnterpriseDB: Embracing Open-Source Database Solutions</title>
      <dc:creator>Ahmed Mohamed</dc:creator>
      <pubDate>Fri, 14 Jul 2023 17:47:25 +0000</pubDate>
      <link>https://dev.to/ahmedmohamed/unleashing-the-potential-of-edb-enterprisedb-embracing-open-source-database-solutions-3781</link>
      <guid>https://dev.to/ahmedmohamed/unleashing-the-potential-of-edb-enterprisedb-embracing-open-source-database-solutions-3781</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In the realm of enterprise grade databases EDB EnterpriseDB emerges as a remarkable and adaptable open source database management system (DBMS) that empowers businesses to achieve outstanding performance, scalability, and cost effectiveness. Developed by EnterpriseDB. EDB Postgres combines the dependability and robustness of the PostgreSQL open source database with enterprise grade functionalities and comprehensive support. &lt;/p&gt;

&lt;p&gt;This article delves into the fundamental features and advantages of EDB EnterpriseDB shedding light on why it is gaining popularity among organizations in search of a resilient and flexible database solution.&lt;/p&gt;

&lt;h2&gt;
  
  
  Powerful Features
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;PostgreSQL Foundation:&lt;br&gt;
At its core. EDB EnterpriseDB is constructed upon the PostgreSQL database, renowned for its unwavering reliability, data integrity, and extensibility. &lt;br&gt;
By preserving compatibility with PostgreSQL. EDB Postgres ensures smooth transitions for existing applications and tools to embrace EDB EnterpriseDB without significant modifications. This foundation empowers organizations to leverage the extensive ecosystem and community support present within PostgreSQL—including an array of plugins, extensions, and tools. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Advanced Performance and Scalability:&lt;br&gt;
EDB EnterpriseDB is designed to handle mission critical workloads with unparalleled performance and scalability. It incorporates a multitude of performance enhancing features including parallel processing, query optimization techniques, and advanced indexing mechanisms. Moreover this database encompasses built in sharding capabilities that effortlessly enable horizontal scaling—facilitating seamless management of growing data volumes and high traffic scenarios for organizations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Enterprise-Grade Security:&lt;br&gt;
Security is given high priority by EDB EnterpriseDB, which excels in this area. It offers a wide range of security features such as data encryption both at rest and in transit, secure authentication mechanisms, role-based access control (RBAC), and fine-grained auditing capabilities. With these features, EDB EnterpriseDB ensures that sensitive information remains protected from unauthorized access and complies with industry regulations. Additionally, it provides comprehensive support options to promptly resolve any critical issues.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;High Availability and Disaster Recovery:&lt;br&gt;
High Availability and Disaster Recovery are crucial for businesses, as downtime can have severe consequences. EDB EnterpriseDB offers various features to ensure continuous operations and minimize downtime. These include built-in replication mechanisms, automatic failover, and support for geographically distributed clusters. Organizations can achieve near-zero downtime and rapid disaster recovery in case of system failures or natural disasters.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Extensibility and Compatibility:&lt;br&gt;
EDB EnterpriseDB provides Extensibility and Compatibility by offering extensive support for SQL, making it compatible with a wide range of applications and frameworks. It also provides support for programming languages such as Python, Java, and C++, allowing developers to work in their preferred language. The extensibility of EDB EnterpriseDB is enhanced by the vast ecosystem of PostgreSQL, enabling the integration of custom-built or third-party extensions to meet specific business requirements.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Benefits for Organizations
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Cost-Effectiveness:&lt;br&gt;
Organizations benefit from the Cost-Effectiveness of EDB EnterpriseDB, as it significantly reduces licensing and maintenance costs compared to proprietary database solutions. The open-source nature of EDB Postgres eliminates the need for expensive licensing fees, while comprehensive support ensures expert assistance when needed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Flexibility and Agility:&lt;br&gt;
Flexibility and Agility are provided by EDB EnterpriseDB, allowing organizations to adapt and scale their database environment according to evolving business needs. Its compatibility with PostgreSQL facilitates seamless migration from existing database systems, while the extensive feature set enables customization and optimization based on specific requirements. This agility enables organizations to respond quickly to changing market dynamics and stay ahead of the competition.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reliability and Support:&lt;br&gt;
Reliability and Support are crucial for organizations, and EnterpriseDB has a proven track record in providing reliable and robust support for EDB EnterpriseDB. Organizations benefit from timely bug fixes, security patches, and regular updates to ensure the stability and longevity of their database infrastructure. Comprehensive support options, including 24/7 support, guarantee that critical issues can be resolved promptly.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Ref:&lt;br&gt;
&lt;a href="https://www.enterprisedb.com/docs/"&gt;EDB DOCs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>edb</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Debugging Session for AGE using VSCode</title>
      <dc:creator>Ahmed Mohamed</dc:creator>
      <pubDate>Wed, 28 Jun 2023 21:05:17 +0000</pubDate>
      <link>https://dev.to/ahmedmohamed/debugging-session-for-age-using-vscode-ejc</link>
      <guid>https://dev.to/ahmedmohamed/debugging-session-for-age-using-vscode-ejc</guid>
      <description>&lt;p&gt;In this blog we will have a debugging session using vscode it looks similar to the previous blog using GDB but here we will add some configurations for vscode.&lt;/p&gt;

&lt;p&gt;After opening vscode on the age project directory, you will see &lt;code&gt;.vscode&lt;/code&gt; directory. Make sure that to put all the following configurations&lt;br&gt;
&lt;code&gt;Note: replace 'yourUserName' in the following files with your current system username&lt;/code&gt;&lt;br&gt;
launch.json&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Use&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;IntelliSense&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;learn&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;about&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;possible&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;attributes.&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Hover&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;to&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;view&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;descriptions&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;of&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;existing&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;attributes.&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;For&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;more&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;information&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;visit:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;https://go.microsoft.com/fwlink/?linkid=&lt;/span&gt;&lt;span class="mi"&gt;830387&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"0.2.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"configurations"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"(gdb) Attach"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"cppdbg"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"request"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"attach"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"program"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/home/yourUserName/postgresql-14.7/bin/postgres"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"MIMode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"gdb"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"setupCommands"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Enable pretty-printing for gdb"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"-enable-pretty-printing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"ignoreFailures"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Set Disassembly Flavor to Intel"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"-gdb-set disassembly-flavor intel"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"ignoreFailures"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;settings.json&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"files.associations"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"postgres.h"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"genam.h"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"heapam.h"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"tableam.h"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"table.h"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"htup_details.h"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"skey.h"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"pg_operator.h"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"namespace.h"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;c_cpp_properties.json&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"configurations"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Linux"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"includePath"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"/usr/include/**/**"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"${workspaceFolder}/**"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"/usr/include/**"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"/usr/local/pgsql/include/**"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"/usr/local/pgsql/include/server/**"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"/home/yourUserName/postgresql-14.7/src/**"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"/home/yourUserName/postgresql-14.7/**"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"/home/yourUserName/postgresql-14.7/src/backend/**"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"/usr/local/pgsql/lib/**"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="s2"&gt;"${workspaceFolder}/src/include/**"&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"defines"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"compilerPath"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/usr/bin/gcc"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"cStandard"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"c11"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"cppStandard"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"gnu++17"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"intelliSenseMode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"linux-gcc-x64"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nl"&gt;"configurationProvider"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ms-vscode.makefile-tools"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can start debugging &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;START postgres server and CONNECT through psql session&lt;/li&gt;
&lt;li&gt;In the psql terminal get the session pid using command &lt;code&gt;SELECT pg_backend_pid();&lt;/code&gt; &lt;/li&gt;
&lt;li&gt;Set your breakpoints&lt;/li&gt;
&lt;li&gt;press F5 then type PID that you got in a previous step&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;run a query on the &lt;code&gt;psql&lt;/code&gt; terminal and the debugging will begin.&lt;/p&gt;

&lt;p&gt;Ref:&lt;br&gt;
&lt;a href="https://github.com/apache/age"&gt;apache age repo&lt;/a&gt;&lt;/p&gt;

</description>
      <category>apacheage</category>
      <category>postgres</category>
    </item>
    <item>
      <title>Debugging Session for AGE using GDB</title>
      <dc:creator>Ahmed Mohamed</dc:creator>
      <pubDate>Wed, 28 Jun 2023 20:39:21 +0000</pubDate>
      <link>https://dev.to/ahmedmohamed/debugging-session-for-age-using-gdb-3k8e</link>
      <guid>https://dev.to/ahmedmohamed/debugging-session-for-age-using-gdb-3k8e</guid>
      <description>&lt;p&gt;After have Postgres configured with enabling debugging flags and a running Postgres instance. An open session running and age extension is loaded&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Get PID of the current session
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;SELECT pg_backend_pid();&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Open new terminal tab and run &lt;code&gt;sudo gdb&lt;/code&gt; to run the debugger&lt;/li&gt;
&lt;li&gt;Attach gdb to to the PID that we got from the previous step e.g. PID: 123
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;(gdb) attach 123&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add a break point to a specific line or function  at some where
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;(gdb) b &amp;lt;function_name&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;The following are The basic GDB commands:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;b for breakpoint, (b )&lt;/li&gt;
&lt;li&gt;c for continue - continues to the next breakpoint&lt;/li&gt;
&lt;li&gt;n for next line&lt;/li&gt;
&lt;li&gt;s for step into&lt;/li&gt;
&lt;li&gt;p for print, (p *) for pointers&lt;/li&gt;
&lt;li&gt;d for delete all breakpoints&lt;/li&gt;
&lt;li&gt;q for quit&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ref:&lt;br&gt;
&lt;a href="https://github.com/apache/age"&gt;apache age repo&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.sourceware.org/gdb/documentation/"&gt;GDB Docs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>apacheage</category>
      <category>postgres</category>
    </item>
    <item>
      <title>AGE Contribution Guide</title>
      <dc:creator>Ahmed Mohamed</dc:creator>
      <pubDate>Wed, 28 Jun 2023 19:31:27 +0000</pubDate>
      <link>https://dev.to/ahmedmohamed/age-contribution-guide-50bk</link>
      <guid>https://dev.to/ahmedmohamed/age-contribution-guide-50bk</guid>
      <description>&lt;p&gt;In the previous blog we wrote &lt;code&gt;add_two_numbers&lt;/code&gt; function implementation.&lt;/p&gt;

&lt;p&gt;file name is &lt;code&gt;add_numbers.c&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;"postgres.h"&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;string.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt; &lt;span class="cpf"&gt;"fmgr.h"&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="n"&gt;PG_MODULE_MAGIC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;PG_FUNCTION_INFO_V1&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;add_one&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;Datum&lt;/span&gt;
&lt;span class="nf"&gt;add_two_numbers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PG_FUNCTION_ARGS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;int32&lt;/span&gt;   &lt;span class="n"&gt;arg1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PG_GETARG_INT32&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;int32&lt;/span&gt;   &lt;span class="n"&gt;arg2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PG_GETARG_INT32&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="n"&gt;PG_RETURN_INT32&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arg1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;arg2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Now, let's add this function to age.&lt;br&gt;
save the file in the following path: &lt;code&gt;src/backend/commands&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;then add the next line to makefile on the top directory of the project&lt;br&gt;
&lt;code&gt;src/backend/commands/add_numbers.o&lt;/code&gt;&lt;br&gt;
add this line in OBJS section.&lt;/p&gt;

&lt;p&gt;Add the signature to the age--1.3.0.sql at the end of the file&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;CREATE&lt;/span&gt; &lt;span class="k"&gt;FUNCTION&lt;/span&gt; &lt;span class="n"&gt;ag_catalog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add_numbers&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;RETURNS&lt;/span&gt; &lt;span class="nb"&gt;Integer&lt;/span&gt;
&lt;span class="k"&gt;LANGUAGE&lt;/span&gt; &lt;span class="k"&gt;c&lt;/span&gt;
&lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="s1"&gt;'MODULE_PATHNAME'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then run the following commands in the project directory&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;make clean &lt;span class="nv"&gt;PG_CONFIG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/local/pgsql/bin/pg_config
&lt;span class="nb"&gt;sudo &lt;/span&gt;make &lt;span class="nv"&gt;PG_CONFIG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/local/pgsql/bin/pg_config
&lt;span class="nb"&gt;sudo &lt;/span&gt;make &lt;span class="nb"&gt;install &lt;/span&gt;&lt;span class="nv"&gt;PG_CONFIG&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/local/pgsql/bin/pg_config
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we are done, after running the postgres server you can use this function as follows&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="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;ag_catalog&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add_numbers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://github.com/apache/age"&gt;apache age github repo&lt;/a&gt;&lt;br&gt;
&lt;a href="https://dev.to/ahmedmohamed/create-custom-function-in-postgres-bjc"&gt;Create a Custom Function in Postgres&lt;/a&gt;&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>apacheage</category>
      <category>postgressql</category>
    </item>
    <item>
      <title>Create a Custom Function in Postgres</title>
      <dc:creator>Ahmed Mohamed</dc:creator>
      <pubDate>Wed, 28 Jun 2023 19:03:27 +0000</pubDate>
      <link>https://dev.to/ahmedmohamed/create-custom-function-in-postgres-bjc</link>
      <guid>https://dev.to/ahmedmohamed/create-custom-function-in-postgres-bjc</guid>
      <description>&lt;p&gt;User-defined functions can be written in C language. Such functions are compiled into dynamically loadable objects.&lt;/p&gt;

&lt;h2&gt;
  
  
  function implementation in c
&lt;/h2&gt;

&lt;p&gt;The version-1 calling convention relies on macros to suppress most of the complexity of passing arguments and results. the declaration of a version-1 function will be as follows&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="n"&gt;Datum&lt;/span&gt; &lt;span class="n"&gt;funcname&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PG_FUNCTION_ARGS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;before that we will add the macro call&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="n"&gt;PG_FUNCTION_INFO_V1&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;funcname&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to declare the function name&lt;/p&gt;

&lt;p&gt;then the function implementation of adding two numbers will be as follows.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="cp"&gt;#include&lt;/span&gt; &lt;span class="cpf"&gt;"postgres.h"&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt; &lt;span class="cpf"&gt;&amp;lt;string.h&amp;gt;&lt;/span&gt;&lt;span class="cp"&gt;
#include&lt;/span&gt; &lt;span class="cpf"&gt;"fmgr.h"&lt;/span&gt;&lt;span class="cp"&gt;
&lt;/span&gt;
&lt;span class="n"&gt;PG_MODULE_MAGIC&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;PG_FUNCTION_INFO_V1&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;add_one&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;Datum&lt;/span&gt;
&lt;span class="nf"&gt;add_two_numbers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;PG_FUNCTION_ARGS&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;int32&lt;/span&gt;   &lt;span class="n"&gt;arg1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PG_GETARG_INT32&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="n"&gt;int32&lt;/span&gt;   &lt;span class="n"&gt;arg2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;PG_GETARG_INT32&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="n"&gt;PG_RETURN_INT32&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;arg1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;arg2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;notice that &lt;code&gt;PG_RETURN_xxx&lt;/code&gt; or &lt;code&gt;PG_GETARG_xxx&lt;/code&gt;&lt;br&gt;
where &lt;code&gt;xxx&lt;/code&gt; refer to the variable datatype&lt;/p&gt;

&lt;p&gt;then, we could define the functions to PostgreSQL with commands like this&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;CREATE&lt;/span&gt; &lt;span class="k"&gt;FUNCTION&lt;/span&gt; &lt;span class="n"&gt;add_one&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;integer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;span class="k"&gt;RETURNS&lt;/span&gt; &lt;span class="nb"&gt;integer&lt;/span&gt;
&lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="s1"&gt;'DIRECTORY/funcs'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'add_two_numbers'&lt;/span&gt;
&lt;span class="k"&gt;LANGUAGE&lt;/span&gt; &lt;span class="k"&gt;C&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ref:&lt;br&gt;
&lt;a href="https://www.postgresql.org/docs/current/extend.html"&gt;postgresql documentation&lt;/a&gt;&lt;/p&gt;

</description>
      <category>postgres</category>
      <category>apacheage</category>
      <category>database</category>
    </item>
  </channel>
</rss>
