mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-17 02:51:45 -05:00
handle large databases (#1845)
This commit is contained in:
@@ -166,12 +166,15 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
// NOTES: Converting the size to BIGINT is need to handle the large database scenarios.
|
||||||
|
// size column in sys.master_files represents the number of pages and each page is 8 KB
|
||||||
|
// The end result is size in MB.
|
||||||
return @"
|
return @"
|
||||||
WITH
|
WITH
|
||||||
db_size
|
db_size
|
||||||
AS
|
AS
|
||||||
(
|
(
|
||||||
SELECT database_id, CAST(SUM(size) * 8.0 / 1024 AS INTEGER) size
|
SELECT database_id, CAST(SUM(CAST(size AS BIGINT)) * 8.0 / 1024 AS BIGINT) size
|
||||||
FROM sys.master_files
|
FROM sys.master_files
|
||||||
GROUP BY database_id
|
GROUP BY database_id
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user