0% found this document useful (0 votes)
69 views3 pages

Migration From MSSQL To PostgreSQL

The document outlines key challenges in migrating from MSSQL to PostgreSQL, including differences in SQL syntax, stored procedures, data types, and performance optimization. It also highlights disadvantages of PostgreSQL compared to MSSQL, such as lack of built-in enterprise features and limited GUI management tools. Additionally, it emphasizes the need for application-level changes and recommends updating applications to the latest technology during the migration process.

Uploaded by

Mamun Kabir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
69 views3 pages

Migration From MSSQL To PostgreSQL

The document outlines key challenges in migrating from MSSQL to PostgreSQL, including differences in SQL syntax, stored procedures, data types, and performance optimization. It also highlights disadvantages of PostgreSQL compared to MSSQL, such as lack of built-in enterprise features and limited GUI management tools. Additionally, it emphasizes the need for application-level changes and recommends updating applications to the latest technology during the migration process.

Uploaded by

Mamun Kabir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Key Challenges in Migration from MSSQL to PostgreSQL

1. Differences in SQL Syntax & Features


○ MSSQL and PostgreSQL have different SQL dialects.
○ Functions like GETDATE(), IDENTITY, TOP (in MSSQL) will need to be rewritten
to NOW(), SERIAL, and LIMIT in PostgreSQL.
2. Stored Procedures & Functions Migration & Views
○ MSSQL uses T-SQL, whereas PostgreSQL uses PL/pgSQL.
○ Any stored procedures, triggers, and user-defined functions will require rewriting.
○ MSSQL views needs to be rewrite
3. Data Type Differences
○ MSSQL uses DATETIME, DATETIME2, and SMALLDATETIME, whereas
PostgreSQL uses TIMESTAMP and TIMESTAMPTZ.
○ MSSQL’s UNIQUEIDENTIFIER (GUIDs) needs mapping to UUID in
PostgreSQL.
○ BIT in MSSQL maps to BOOLEAN in PostgreSQL.
4. Identity Columns & Auto-Incrementing Keys
○ MSSQL uses IDENTITY(1,1), whereas PostgreSQL uses SERIAL or
GENERATED ALWAYS AS IDENTITY.
5. Transactions & Error Handling
○ TRY...CATCH blocks in T-SQL don’t work in PostgreSQL; alternative exception
handling using BEGIN...EXCEPTION is required.
6. Performance Optimization
○ Query execution plans differ between MSSQL and PostgreSQL.
○ Indexing strategies need to be revisited (CLUSTERED INDEX in MSSQL vs.
default B-TREE indexing in PostgreSQL).
7. SSRS & Other Microsoft Tools
○ SQL Server Reporting Services (SSRS) and SQL Server Integration Services
(SSIS) do not work with PostgreSQL, requiring alternatives like Metabase,
JasperReports, or Power BI with PostgreSQL support.
8. Application-Level Changes in .NET Core
○ Entity Framework Core (EF Core) Provider Change:
■ MSSQL: Microsoft.EntityFrameworkCore.SqlServer
■ PostgreSQL: Npgsql.EntityFrameworkCore.PostgreSQL
○ Queries using MSSQL-specific functions (NEWID(), DATENAME(), etc.) need to
be modified.
○ LINQ queries need validation against PostgreSQL.
9. Migration & Data Consistency Issues
○ Large databases with millions of records will take time to migrate.
○ Potential data loss or corruption if not properly validated.
Disadvantages of PostgreSQL Over MSSQL

1. Lack of Built-in Enterprise Features


○ MSSQL provides SQL Server Agent, Database Mail, Replication, and Always
On Availability Groups, which are not natively available in PostgreSQL.
2. Limited GUI Management Tools
○ MSSQL has SQL Server Management Studio (SSMS) with strong debugging
tools.
○ PostgreSQL relies on pgAdmin, which has fewer capabilities.
3. Weaker Windows Ecosystem Support
○ MSSQL integrates well with Active Directory (AD), Windows Authentication,
Power BI, and .NET applications.
○ PostgreSQL lacks seamless integration with Microsoft technologies.
4. No Native JSON Support as Strong as MSSQL
○ PostgreSQL has JSONB, but MSSQL offers better performance for structured
JSON queries.
5. Backup & Restore Complexity
○ MSSQL has simple .bak file backups with point-in-time recovery.
○ PostgreSQL requires pg_dump and WAL-based backups, which need
additional setup.
6. Concurrency & Locking
○ MSSQL handles concurrent transactions efficiently with row-level locks.
○ PostgreSQL relies on MVCC (Multi-Version Concurrency Control), which may
lead to bloated tables and require VACUUM tuning.
7. Indexing & Performance Tuning Complexity
○ MSSQL automatically creates statistics for better query optimization.
○ PostgreSQL requires manual statistics updates for indexes.

Application changes required for DB Migrations:

Transactions and Locking


 PostgreSQL and MSSQL have different models for handling transactions and locks.
 Testing applications under load to ensure that the locking mechanisms in PostgreSQL (like
MVCC) handle concurrent transactions as efficiently as in MSSQL.

Third-Party Tools and Libraries


 If your ASP.NET WebForms application relies on third-party libraries or tools that are
MSSQL-specific, you may need to find PostgreSQL-compatible alternatives.

 Some tools, such as Entity Framework, have support for PostgreSQL through the Npgsql
provider, but other tools may need to be replaced.

Performance tuning is also required to check for applications

Alhiyal core framework needs to be updated to support


Our Recommendation
If you migrate the application DB then you must migrate the applications to latest
technology(web core api, angular).

You might also like