{"id":29097375,"url":"https://github.com/microsoftcloudessentials-learninghub/azdatabase-freeing-unused-space","last_synced_at":"2026-02-03T01:37:16.151Z","repository":{"id":294504267,"uuid":"987189097","full_name":"MicrosoftCloudEssentials-LearningHub/azDataBase-Freeing-Unused-Space","owner":"MicrosoftCloudEssentials-LearningHub","description":"This repository contains demos and guides for Optimizing Azure Database Performance by Freeing Up Unused Space.  These demos are intended as a guide. For official guidance, support, or more detailed information, please refer to Microsoft's official documentation or contact Microsoft support directly.","archived":false,"fork":false,"pushed_at":"2026-01-13T21:55:23.000Z","size":183,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-13T23:59:49.454Z","etag":null,"topics":["azure-databases","database-strategy","free-space","optimization","performance"],"latest_commit_sha":null,"homepage":"","language":"TSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MicrosoftCloudEssentials-LearningHub.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-20T17:51:48.000Z","updated_at":"2026-01-13T21:55:16.000Z","dependencies_parsed_at":"2025-05-21T20:26:27.131Z","dependency_job_id":null,"html_url":"https://github.com/MicrosoftCloudEssentials-LearningHub/azDataBase-Freeing-Unused-Space","commit_stats":null,"previous_names":["microsoftcloudessentials-learninghub/azdbs-freeing-unused-space","microsoftcloudessentials-learninghub/azdatabase-freeing-unused-space"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MicrosoftCloudEssentials-LearningHub/azDataBase-Freeing-Unused-Space","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicrosoftCloudEssentials-LearningHub%2FazDataBase-Freeing-Unused-Space","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicrosoftCloudEssentials-LearningHub%2FazDataBase-Freeing-Unused-Space/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicrosoftCloudEssentials-LearningHub%2FazDataBase-Freeing-Unused-Space/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicrosoftCloudEssentials-LearningHub%2FazDataBase-Freeing-Unused-Space/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MicrosoftCloudEssentials-LearningHub","download_url":"https://codeload.github.com/MicrosoftCloudEssentials-LearningHub/azDataBase-Freeing-Unused-Space/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MicrosoftCloudEssentials-LearningHub%2FazDataBase-Freeing-Unused-Space/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29026400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-03T00:53:18.321Z","status":"ssl_error","status_checked_at":"2026-02-03T00:51:45.186Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure-databases","database-strategy","free-space","optimization","performance"],"created_at":"2025-06-28T13:42:01.749Z","updated_at":"2026-02-03T01:37:16.145Z","avatar_url":"https://github.com/MicrosoftCloudEssentials-LearningHub.png","language":"TSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Azure Databases: \u003cbr/\u003e Optimizing Database Performance \u003cbr/\u003e by Freeing Up Unused Space - Overview\n\nCosta Rica\n\n[![GitHub](https://badgen.net/badge/icon/github?icon=github\u0026label)](https://github.com) \n[![GitHub](https://img.shields.io/badge/--181717?logo=github\u0026logoColor=ffffff)](https://github.com/)\n[brown9804](https://github.com/brown9804)\n\nLast updated: 2025-07-16\n\n----------\n\n\u003e [!IMPORTANT]\n\u003e Please note that `these demos are intended as a guide and are based on my personal experiences. For official guidance, support, or more detailed information, please refer to Microsoft's official documentation or contact Microsoft directly`: [Microsoft Sales and Support](https://support.microsoft.com/contactus?ContactUsExperienceEntryPointAssetId=S.HP.SMC-HOME)\n\n\u003e Microsoft offers a variety of database solutions, both relational and non-relational. Quick overview about strategies for managing and reducing their size, ensuring optimal performance and efficient use of storage resources. It's essential to `follow best practices and monitor the operation to avoid potential issues like long-running commands or blocking sessions`.\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eList of References \u003c/b\u003e (Click to expand)\u003c/summary\u003e\n\n- [Shrink a database](https://learn.microsoft.com/en-us/sql/relational-databases/databases/shrink-a-database?view=sql-server-ver16)\n- [Types of Databases](https://azure.microsoft.com/en-gb/products/category/databases/)\n- [Shrink Database Task (Maintenance Plan)](https://learn.microsoft.com/en-us/sql/relational-databases/maintenance-plans/shrink-database-task-maintenance-plan?view=sql-server-ver16)\n- [Manage file space for databases in Azure SQL Database](https://learn.microsoft.com/en-us/azure/azure-sql/database/file-space-manage?view=azuresql-db)\n- [DBCC SHRINKFILE (Transact-SQL)](https://learn.microsoft.com/en-us/sql/t-sql/database-console-commands/dbcc-shrinkfile-transact-sql?view=sql-server-ver16)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eTable of Content \u003c/b\u003e (Click to expand)\u003c/summary\u003e\n\n- [Overview](#overview)\n- [Relational Databases](#relational-databases)\n  - [Azure SQL Database](#azure-sql-database)\n  - [Azure SQL Managed Instance](#azure-sql-managed-instance)\n  - [SQL Server on Azure Virtual Machines](#sql-server-on-azure-virtual-machines)\n  - [Azure Database for PostgreSQL](#azure-database-for-postgresql)\n  - [Azure Database for MySQL](#azure-database-for-mysql)\n- [Non-Relational Databases](#non-relational-databases)\n  - [Azure Cosmos DB](#azure-cosmos-db)\n  - [Azure Managed Instance for Apache Cassandra](#azure-managed-instance-for-apache-cassandra)\n  - [Azure Cache for Redis](#azure-cache-for-redis)\n\n\u003c/details\u003e\n\n## Overview \n\n\u003e General Strategies for All Databases:\n\n- **Archiving Old Data**: Move old or rarely accessed data to an archive database or storage solution. Reduces the size of the active database, improving performance and manageability. `Use SQL Server's built-in tools or third-party solutions to archive data based on specific criteria (e.g., date, usage).`\n- **Data Compression**: Apply data compression techniques to reduce storage space.\n- **Partitioning Tables**: Split large tables into smaller, more manageable pieces.\n- **Index Optimization**: Regularly rebuild or reorganize indexes to reduce fragmentation.\n- **Removing Unused Indexes**: Identify and remove indexes that are not being used.\n- **Cleaning Up Unused Data**: Regularly delete or archive unused or obsolete data.\n- **Monitoring and Maintenance**: Regularly monitor database size and performance, and perform maintenance tasks.\n- **Using Filegroups**: Distribute database objects across multiple filegroups to improve performance and manageability.\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/user-attachments/assets/81d088ab-da80-4643-9c2c-2558709c90ff\" alt=\"Centered Image\" style=\"border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;\"/\u003e\n\u003c/div\u003e\n\nFrom [Managing database file space in Azure SQL Database](https://learn.microsoft.com/zh-cn/azure/azure-sql/database/file-space-manage?view=azuresql-db)\n\n\u003e General Tips:\n\n| **Category**             | **Recommendation**                                                                                                                                                                                                 |\n|--------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Regular Maintenance**  | Perform regular database maintenance tasks such as index rebuilding, updating statistics, and cleaning up old data.|\n| **Monitoring and Alerts**| Set up monitoring and alerts to notify you when free space falls below your defined thresholds. Use Azure Monitor and SQL Insights for comprehensive monitoring.|\n| **Backup and Recovery**  | Ensure you have a robust backup and recovery strategy in place to prevent data loss and minimize downtime.|\n\n## Relational Databases\n\n```mermaid\ngraph TD\n    A[Relational Databases]\n\n    A1[Azure SQL Database]\n    A2[Azure SQL Managed Instance]\n    A3[SQL Server on Azure Virtual Machines]\n    A4[Azure Database for PostgreSQL]\n    A5[Azure Database for MySQL]\n\n    A --\u003e A1\n    A --\u003e A2\n    A --\u003e A3\n    A --\u003e A4\n    A --\u003e A5\n\n    A1 --\u003e A1_1[Shrinking the Database]\n    A1 --\u003e A1_2[Data Compression]\n    A1 --\u003e A1_3[Index Optimization]\n    A1 --\u003e A1_4[Partitioning Tables]\n\n    A2 --\u003e A2_1[Shrinking the Database]\n    A2 --\u003e A2_2[Archiving Old Data]\n    A2 --\u003e A2_3[Removing Unused Indexes]\n    A2 --\u003e A2_4[Using Filegroups]\n\n    A3 --\u003e A3_1[Cleaning Up Unused Data]\n    A3 --\u003e A3_2[Monitoring and Maintenance]\n    A3 --\u003e A3_3[Data Compression]\n\n    A4 --\u003e A4_1[Partitioning Tables]\n    A4 --\u003e A4_2[Index Optimization]\n    A4 --\u003e A4_3[Archiving Old Data]\n\n    A5 --\u003e A5_1[Data Compression]\n    A5 --\u003e A5_2[Index Optimization]\n    A5 --\u003e A5_3[Cleaning Up Unused Data]\n```\n\n### Azure SQL Database\n\n\u003e Click here for additional information on this topic [Azure SQL Database: Freeing Up Unused Space - Overview](./relational/0_az-sql-db.md) \n\n### Azure SQL Managed Instance\n\n\u003e Click here for additional information on this topic [Azure SQL Managed Instance: Freeing Up Unused Space - Overview](./relational/1_az-sql-mi.md) \n\n### SQL Server on Azure Virtual Machines\n\n\u003e Click here for additional information on this topic [Azure SQL Managed Instance: Freeing Up Unused Space - Overview](./relational/2_sql-az-vm.md)\n\n### Azure Database for PostgreSQL\n\n\u003e Click here for additional information on this topic [Azure Database for PostgreSQL: Freeing Up Unused Space - Overview](./relational/3_az-postgreSQL.md)\n\n### Azure Database for MySQL\n\n\u003e Click here for additional information on this topic [Azure Database for MySQL: Freeing Up Unused Space - Overview](./relational/4_az-db-mysql.md)\n\n## Non-Relational Databases\n\n```mermaid\ngraph TD\n    A[Non-Relational Databases]\n\n    A1[Azure Cosmos DB]\n    A2[Azure Managed Instance for Apache Cassandra]\n    A3[Azure Cache for Redis]\n\n    A --\u003e A1\n    A --\u003e A2\n    A --\u003e A3\n\n    A1 --\u003e A1_1[Partitioning]\n    A1 --\u003e A1_2[Index Optimization]\n    A1 --\u003e A1_3[Archiving Old Data]\n\n    A2 --\u003e A2_1[Data Compression]\n    A2 --\u003e A2_2[Index Optimization]\n    A2 --\u003e A2_3[Cleaning Up Unused Data]\n\n    A3 --\u003e A3_1[Data Eviction Policies]\n    A3 --\u003e A3_2[Monitoring and Maintenance]\n```\n\n### Azure Cosmos DB\n\n\u003e Click here for additional information on this topic [Azure Cosmos DB: Freeing Up Unused Space - Overview](./non-relational/0_az-cosmosdb.md)\n\n### Azure Managed Instance for Apache Cassandra\n\n\u003e Click here for additional information on this topic [Azure Managed Instance for Apache Cassandra: Freeing Up Unused Space - Overview](./non-relational/1_az-mi-apache-cassandra.md)\n\n### Azure Cache for Redis\n\n\u003e Click here for additional information on this topic [Azure Cache for Redis: Freeing Up Unused Space - Overview](./non-relational/2_az-cache-redis.md)\n\n\u003c!-- START BADGE --\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Total%20views-31-limegreen\" alt=\"Total views\"\u003e\n  \u003cp\u003eRefresh Date: 2025-07-16\u003c/p\u003e\n\u003c/div\u003e\n\u003c!-- END BADGE --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoftcloudessentials-learninghub%2Fazdatabase-freeing-unused-space","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoftcloudessentials-learninghub%2Fazdatabase-freeing-unused-space","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoftcloudessentials-learninghub%2Fazdatabase-freeing-unused-space/lists"}