Утрамбовать таблицу

Relic Hunter
Дата: 02.05.2015 01:25:29
Есть таблица А размером 2.5ГБ. Если сделать ее копию то ее размер около 1.6ГБ. Есть какие-то средства (онлайн) шринкануть таблицу без пересоздания? База постоянно в онлайне.
komrad
Дата: 02.05.2015 01:36:59
Relic Hunter
Есть таблица А размером 2.5ГБ. Если сделать ее копию то ее размер около 1.6ГБ. Есть какие-то средства (онлайн) шринкануть таблицу без пересоздания? База постоянно в онлайне.

у вас наверно плотность данных на страницу %60
приведите индексы по таблице
Relic Hunter
Дата: 02.05.2015 01:50:12
komrad,

+
CREATE TABLE [dbo].[LedgerMisc](
	[Period] [int] NOT NULL,
	[PostSeq] [int] NOT NULL,
	[PKey] [varchar](32) NOT NULL,
	[WBS1] [varchar](30) NULL,
	[WBS2] [varchar](7) NULL,
	[WBS3] [varchar](7) NULL,
	[Account] [varchar](13) NULL,
	[Org] [varchar](14) NULL,
	[TransType] [varchar](2) NULL,
	[SubType] [varchar](1) NULL,
	[RefNo] [varchar](12) NULL,
	[TransDate] [datetime] NULL,
	[Desc1] [varchar](80) NULL,
	[Desc2] [varchar](80) NULL,
	[Amount] [decimal](19, 4) NOT NULL,
	[CBAmount] [decimal](19, 4) NOT NULL,
	[BillExt] [decimal](19, 4) NOT NULL,
	[ProjectCost] [varchar](1) NOT NULL,
	[AutoEntry] [varchar](1) NOT NULL,
	[SuppressBill] [varchar](1) NOT NULL,
	[BillStatus] [varchar](1) NULL,
	[SkipGL] [varchar](1) NOT NULL,
	[BankCode] [varchar](10) NULL,
	[Invoice] [varchar](12) NULL,
	[InvoiceSection] [varchar](1) NULL,
	[Employee] [varchar](20) NULL,
	[Vendor] [varchar](20) NULL,
	[Line] [smallint] NOT NULL,
	[PartialPayment] [decimal](19, 4) NOT NULL,
	[Discount] [decimal](19, 4) NOT NULL,
	[Voucher] [varchar](12) NULL,
	[BilledWBS1] [varchar](30) NULL,
	[BilledWBS2] [varchar](7) NULL,
	[BilledWBS3] [varchar](7) NULL,
	[BilledInvoice] [varchar](12) NULL,
	[BilledPeriod] [int] NOT NULL,
	[Unit] [varchar](11) NULL,
	[UnitTable] [varchar](30) NULL,
	[UnitQuantity] [decimal](19, 4) NOT NULL,
	[UnitCostRate] [decimal](19, 4) NOT NULL,
	[UnitBillingRate] [decimal](19, 4) NOT NULL,
	[UnitBillExt] [decimal](19, 4) NOT NULL,
	[XferWBS1] [varchar](30) NULL,
	[XferWBS2] [varchar](7) NULL,
	[XferWBS3] [varchar](7) NULL,
	[XferAccount] [varchar](13) NULL,
	[TaxCode] [varchar](10) NULL,
	[TaxAmount] [decimal](19, 4) NOT NULL,
	[TaxCBAmount] [decimal](19, 4) NOT NULL,
	[TaxBasis] [decimal](19, 4) NOT NULL,
	[TaxCBBasis] [decimal](19, 4) NOT NULL,
	[BillTaxCodeOverride] [varchar](10) NULL,
	[WrittenOffPeriod] [int] NOT NULL,
	[TransactionAmount] [decimal](19, 4) NOT NULL,
	[TransactionCurrencyCode] [varchar](3) NULL,
	[ExchangeInfo] [varchar](max) NULL,
	[AmountProjectCurrency] [decimal](19, 4) NOT NULL,
	[ProjectExchangeInfo] [varchar](max) NULL,
	[AmountBillingCurrency] [decimal](19, 4) NOT NULL,
	[BillingExchangeInfo] [varchar](max) NULL,
	[AutoEntryAmount] [decimal](19, 4) NOT NULL,
	[AutoEntryExchangeInfo] [varchar](max) NULL,
	[AutoEntryOrg] [varchar](14) NULL,
	[AutoEntryAccount] [varchar](13) NULL,
	[AmountSourceCurrency] [decimal](19, 4) NOT NULL,
	[SourceExchangeInfo] [varchar](max) NULL,
	[PONumber] [varchar](30) NULL,
	[UnitCostRateBillingCurrency] [decimal](19, 4) NOT NULL,
	[LinkCompany] [varchar](14) NULL,
	[LinkWBS1] [varchar](30) NULL,
	[LinkWBS2] [varchar](7) NULL,
	[LinkWBS3] [varchar](7) NULL,
	[Tax2Code] [varchar](10) NULL,
	[Tax2Amount] [decimal](19, 4) NOT NULL,
	[Tax2CBAmount] [decimal](19, 4) NOT NULL,
	[CompoundTax] [varchar](1) NOT NULL,
	[BillTax2CodeOverride] [varchar](10) NULL,
	[GainsAndLossesType] [varchar](1) NULL,
	[Tax2Basis] [decimal](19, 4) NOT NULL,
	[Tax2CBBasis] [decimal](19, 4) NOT NULL,
	[AmountTaxCurrency] [decimal](19, 4) NOT NULL,
	[CBAmountTaxCurrency] [decimal](19, 4) NOT NULL,
	[AmountTax2Currency] [decimal](19, 4) NOT NULL,
	[CBAmountTax2Currency] [decimal](19, 4) NOT NULL,
	[TaxAmountTaxCurrency] [decimal](19, 4) NOT NULL,
	[TaxCBAmountTaxCurrency] [decimal](19, 4) NOT NULL,
	[Tax2AmountTaxCurrency] [decimal](19, 4) NOT NULL,
	[Tax2CBAmountTaxCurrency] [decimal](19, 4) NOT NULL,
	[TaxBasisTaxCurrency] [decimal](19, 4) NOT NULL,
	[TaxCBBasisTaxCurrency] [decimal](19, 4) NOT NULL,
	[Tax2BasisTaxCurrency] [decimal](19, 4) NOT NULL,
	[Tax2CBBasisTaxCurrency] [decimal](19, 4) NOT NULL,
	[TaxAmountFunctionalCurrency] [decimal](19, 4) NOT NULL,
	[TaxCBAmountFunctionalCurrency] [decimal](19, 4) NOT NULL,
	[Tax2AmountFunctionalCurrency] [decimal](19, 4) NOT NULL,
	[Tax2CBAmountFunctionalCurrency] [decimal](19, 4) NOT NULL,
	[TaxBasisFunctionalCurrency] [decimal](19, 4) NOT NULL,
	[TaxCBBasisFunctionalCurrency] [decimal](19, 4) NOT NULL,
	[Tax2BasisFunctionalCurrency] [decimal](19, 4) NOT NULL,
	[Tax2CBBasisFunctionalCurrency] [decimal](19, 4) NOT NULL,
	[TaxAmountSourceCurrency] [decimal](19, 4) NOT NULL,
	[Tax2AmountSourceCurrency] [decimal](19, 4) NOT NULL,
	[DiscountFunctionalCurrency] [decimal](19, 4) NOT NULL,
	[ModUser] [varchar](20) NULL,
	[AuthorizedBy] [varchar](20) NULL,
	[NonRecoverTaxPercent] [decimal](19, 4) NOT NULL,
	[RealizationAmountEmployeeCurrency] [decimal](19, 4) NOT NULL,
	[RealizationAmountProjectCurrency] [decimal](19, 4) NOT NULL,
	[RealizationAmountBillingCurrency] [decimal](19, 4) NOT NULL,
	[NonBill] [varchar](1) NULL,
	[CreditMemoRefNo] [varchar](12) NULL,
	[OriginalAmountSourceCurrency] [decimal](19, 4) NOT NULL,
	[OriginalPaymentCurrencyCode] [varchar](3) NULL,
	[InProcessAccount] [varchar](1) NOT NULL,
	[InProcessAccountCleared] [varchar](1) NOT NULL,
	[EKOriginalLine] [smallint] NOT NULL,
 CONSTRAINT [LedgerMiscPK] PRIMARY KEY NONCLUSTERED 
(
	[Period] ASC,
	[PostSeq] ASC,
	[PKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

SET ANSI_PADDING ON

GO

/****** Object:  Index [LedgerMiscWBS1WBS2WBS3IDX]    Script Date: 5/1/2015 4:48:00 PM ******/
CREATE CLUSTERED INDEX [LedgerMiscWBS1WBS2WBS3IDX] ON [dbo].[LedgerMisc]
(
	[WBS1] ASC,
	[WBS2] ASC,
	[WBS3] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
GO

SET ANSI_PADDING ON

GO

/****** Object:  Index [LedgerMiscAccountIDX]    Script Date: 5/1/2015 4:48:00 PM ******/
CREATE NONCLUSTERED INDEX [LedgerMiscAccountIDX] ON [dbo].[LedgerMisc]
(
	[Account] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
GO

SET ANSI_PADDING ON

GO

/****** Object:  Index [LedgerMiscBilledWBS1WBS2WBS3IDX]    Script Date: 5/1/2015 4:48:00 PM ******/
CREATE NONCLUSTERED INDEX [LedgerMiscBilledWBS1WBS2WBS3IDX] ON [dbo].[LedgerMisc]
(
	[BilledWBS1] ASC,
	[BilledWBS2] ASC,
	[BilledWBS3] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
GO

SET ANSI_PADDING ON

GO

/****** Object:  Index [LedgerMiscBillStatusIDX]    Script Date: 5/1/2015 4:48:00 PM ******/
CREATE NONCLUSTERED INDEX [LedgerMiscBillStatusIDX] ON [dbo].[LedgerMisc]
(
	[BillStatus] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
GO

SET ANSI_PADDING ON

GO

/****** Object:  Index [LedgerMiscCoveringIDX]    Script Date: 5/1/2015 4:48:00 PM ******/
CREATE NONCLUSTERED INDEX [LedgerMiscCoveringIDX] ON [dbo].[LedgerMisc]
(
	[WBS1] ASC,
	[WBS2] ASC,
	[WBS3] ASC,
	[Account] ASC,
	[Vendor] ASC,
	[Employee] ASC,
	[Unit] ASC,
	[UnitTable] ASC,
	[TransDate] ASC,
	[ProjectCost] ASC,
	[TransType] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
GO

SET ANSI_PADDING ON

GO

/****** Object:  Index [LedgerMiscEmployeeVoucherIDX]    Script Date: 5/1/2015 4:48:00 PM ******/
CREATE NONCLUSTERED INDEX [LedgerMiscEmployeeVoucherIDX] ON [dbo].[LedgerMisc]
(
	[Employee] ASC,
	[Voucher] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
GO

SET ANSI_PADDING ON

GO

/****** Object:  Index [LedgerMiscInvoiceIDX]    Script Date: 5/1/2015 4:48:00 PM ******/
CREATE NONCLUSTERED INDEX [LedgerMiscInvoiceIDX] ON [dbo].[LedgerMisc]
(
	[Invoice] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
GO

SET ANSI_PADDING ON

GO

/****** Object:  Index [LedgerMiscTransTypeSubTypeIDX]    Script Date: 5/1/2015 4:48:00 PM ******/
CREATE NONCLUSTERED INDEX [LedgerMiscTransTypeSubTypeIDX] ON [dbo].[LedgerMisc]
(
	[TransType] ASC,
	[SubType] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
GO

SET ANSI_PADDING ON

GO

/****** Object:  Index [LedgerMiscVendorVoucherIDX]    Script Date: 5/1/2015 4:48:00 PM ******/
CREATE NONCLUSTERED INDEX [LedgerMiscVendorVoucherIDX] ON [dbo].[LedgerMisc]
(
	[Vendor] ASC,
	[Voucher] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
GO

SET ANSI_PADDING ON

GO

/****** Object:  Index [LedgerMiscWBS1AccountIDX]    Script Date: 5/1/2015 4:48:00 PM ******/
CREATE NONCLUSTERED INDEX [LedgerMiscWBS1AccountIDX] ON [dbo].[LedgerMisc]
(
	[WBS1] ASC,
	[Account] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [Period]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  CONSTRAINT [DF__LedgerMisc__PostSeq_Def0]  DEFAULT ((0)) FOR [PostSeq]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [Amount]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [CBAmount]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [BillExt]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ('N') FOR [ProjectCost]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ('N') FOR [AutoEntry]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ('N') FOR [SuppressBill]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ('N') FOR [SkipGL]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [Line]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [PartialPayment]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [Discount]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [BilledPeriod]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [UnitQuantity]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [UnitCostRate]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [UnitBillingRate]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [UnitBillExt]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [TaxAmount]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [TaxCBAmount]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [TaxBasis]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [TaxCBBasis]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [WrittenOffPeriod]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [TransactionAmount]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [AmountProjectCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [AmountBillingCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [AutoEntryAmount]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [AmountSourceCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT (0) FOR [UnitCostRateBillingCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [Tax2Amount]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [Tax2CBAmount]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ('N') FOR [CompoundTax]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [Tax2Basis]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [Tax2CBBasis]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [AmountTaxCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [CBAmountTaxCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [AmountTax2Currency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [CBAmountTax2Currency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [TaxAmountTaxCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [TaxCBAmountTaxCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [Tax2AmountTaxCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [Tax2CBAmountTaxCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [TaxBasisTaxCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [TaxCBBasisTaxCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [Tax2BasisTaxCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [Tax2CBBasisTaxCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [TaxAmountFunctionalCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [TaxCBAmountFunctionalCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [Tax2AmountFunctionalCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [Tax2CBAmountFunctionalCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [TaxBasisFunctionalCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [TaxCBBasisFunctionalCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [Tax2BasisFunctionalCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [Tax2CBBasisFunctionalCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [TaxAmountSourceCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [Tax2AmountSourceCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [DiscountFunctionalCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [NonRecoverTaxPercent]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [RealizationAmountEmployeeCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [RealizationAmountProjectCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [RealizationAmountBillingCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  CONSTRAINT [DF__LedgerMisc__NonBill_DefN]  DEFAULT ('N') FOR [NonBill]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [OriginalAmountSourceCurrency]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ('N') FOR [InProcessAccount]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ('N') FOR [InProcessAccountCleared]
GO

ALTER TABLE [dbo].[LedgerMisc] ADD  DEFAULT ((0)) FOR [EKOriginalLine]
GO

ALTER TABLE [dbo].[LedgerMisc]  WITH NOCHECK ADD  CONSTRAINT [FK_LedgerMisc_Account_CA] FOREIGN KEY([Account])
REFERENCES [dbo].[CA] ([Account])
GO

ALTER TABLE [dbo].[LedgerMisc] CHECK CONSTRAINT [FK_LedgerMisc_Account_CA]
GO

ALTER TABLE [dbo].[LedgerMisc]  WITH NOCHECK ADD  CONSTRAINT [FK_LedgerMisc_Employee_EM] FOREIGN KEY([Employee])
REFERENCES [dbo].[EM] ([Employee])
GO

ALTER TABLE [dbo].[LedgerMisc] CHECK CONSTRAINT [FK_LedgerMisc_Employee_EM]
GO

ALTER TABLE [dbo].[LedgerMisc]  WITH NOCHECK ADD  CONSTRAINT [FK_LedgerMisc_Vendor_VE] FOREIGN KEY([Vendor])
REFERENCES [dbo].[VE] ([Vendor])
GO

ALTER TABLE [dbo].[LedgerMisc] CHECK CONSTRAINT [FK_LedgerMisc_Vendor_VE]
GO

ALTER TABLE [dbo].[LedgerMisc]  WITH NOCHECK ADD  CONSTRAINT [FK_LedgerMisc_XferAccount_CA] FOREIGN KEY([XferAccount])
REFERENCES [dbo].[CA] ([Account])
GO

ALTER TABLE [dbo].[LedgerMisc] CHECK CONSTRAINT [FK_LedgerMisc_XferAccount_CA]
GO

Владислав Колосов
Дата: 02.05.2015 10:56:09
Relic Hunter, ALTER TABLE REBUILD.
Jovanny
Дата: 02.05.2015 10:59:00
Relic Hunter
Есть таблица А размером 2.5ГБ. Если сделать ее копию то ее размер около 1.6ГБ. Есть какие-то средства (онлайн) шринкануть таблицу без пересоздания?

А смысл? Если бы было 2,5 Tb, тогда ещё можно бы было пытаться.
Гавриленко Сергей Алексеевич
Дата: 02.05.2015 11:32:38
Jovanny
Relic Hunter
Есть таблица А размером 2.5ГБ. Если сделать ее копию то ее размер около 1.6ГБ. Есть какие-то средства (онлайн) шринкануть таблицу без пересоздания?

А смысл? Если бы было 2,5 Tb, тогда ещё можно бы было пытаться.
Чтобы сэкономить io, но, самое главное, - память.
komrad
Дата: 03.05.2015 11:48:50
Relic Hunter,
а фрагментацию индексов не смотрели еще?

полагаю, что она велика
пересоздайте кластерный индекс
komrad
Дата: 03.05.2015 11:50:05
и приведите значение @@version
Relic Hunter
Дата: 04.05.2015 22:47:49
Microsoft SQL Server 2008 R2 (SP2) - 10.50.4321.0 (X64)
Jul 9 2014 15:59:57
Copyright (c) Microsoft Corporation
Standard Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1)
Relic Hunter
Дата: 04.05.2015 23:03:12
Владислав Колосов
Relic Hunter, ALTER TABLE REBUILD.
Не ужимается.