需求背景
由于目前归档的数据量过大,导致归档过慢,因此需采用快速归档方式进行归档
需求描述
1.ERP新建临时表,将人工刊登的以及智能刊登有销量的listingID存入到临时表中
2.表数据归档通过对应表与临时表比较,不在临时表中的listing则进行归档,对应表如下:
RB_Ebay_Listing_Basic_V2
RB_Ebay_Listing_Attribute_V2
RB_Ebay_Listing_ShippingDetail_V2
RB_Ebay_Listing_Payment_V2
RB_Ebay_Listing_WarehouseList_V2
RB_Ebay_Listing_Product_Sales_V2
RB_Ebay_Listing_Product_V2
RB_Ebay_Listing_Sale_Attach_V2
RB_Ebay_Listing_Shipping_V2
RB_Ebay_Listing_BuyerCondition_V2
RB_Ebay_Listing_Other_V2
RB_Ebay_Listing_ReturnPolicy_V2
RB_Ebay_Listing_DispatchTimeMax_Log
RB_Ebay_Listing_AutoSupplement_V2
RB_Ebay_Listing_VariationAttribute_V2
RB_Ebay_Listing_FitmentValue_V2
RB_Ebay_Listing_Basic_Description_V2
RB_Ebay_Listing_Marketing_Attach_V2
RB_Ebay_Listing_ProductAttribute_V2
RB_Ebay_ItemID_ShipStrategy_V2
RB_Ebay_ItemID_AutoSupplement_V2
RB_Collect_Ebay_NewListingShippingDetail
RB_Ebay_ItemID_Sync_V2
RB_Ebay_Listing_Image_V2
3.以下表数据按添加时间保留半年即可,超过半年自动归档
RB_Ebay_ErrorMessage
RB_Ebay_Listing_Promotion_Log
select top 10 ListingBasicID,ItemID from RB_Ebay_Listing_Basic_V2 where QuantitySold>0 or AdminID !=0
-- 第一步:以下表 根据 ListingBasicID 不在临时表可归档
select top 10 * from RB_Ebay_Listing_Basic_V2
select top 10 * from RB_Ebay_Listing_Product_Sales_V2
select top 10 * from RB_Ebay_Listing_Attribute_V2
select top 10 * from RB_Ebay_Listing_ShippingDetail_V2
select top 10 * from RB_Ebay_Listing_Payment_V2
select top 10 * from RB_Ebay_Listing_WarehouseList_V2
select top 10 * from RB_Ebay_Listing_Product_Sales_V2
select top 10 * from RB_Ebay_Listing_Product_V2
select top 10 * from RB_Ebay_Listing_Sale_Attach_V2
select top 10 * from RB_Ebay_Listing_Shipping_V2
select top 10 * from RB_Ebay_Listing_BuyerCondition_V2
select top 10 * from RB_Ebay_Listing_Other_V2
select top 10 * from RB_Ebay_Listing_ReturnPolicy_V2
select top 10 * from RB_Ebay_Listing_DispatchTimeMax_Log
select top 10 * from RB_Ebay_Listing_AutoSupplement_V2
select top 10 * from RB_Ebay_Listing_VariationAttribute_V2
select top 10 * from RB_Ebay_Listing_FitmentValue_V2
select top 10 * from RB_Ebay_Listing_Basic_Description_V2
select top 10 * from RB_Ebay_Listing_Marketing_Attach_V2
select top 10 * from RB_Ebay_Listing_ProductAttribute_V2
-- 第二步:以下表 根据 ItemId 不在临时表 可归档
select top 10 * from RB_Ebay_ItemID_ShipStrategy_V2
select top 10 * from RB_Ebay_ItemID_AutoSupplement_V2
select top 10 * from RB_Collect_Ebay_NewListingShippingDetail
select top 10 * from RB_Ebay_ItemID_Sync_V2
-- 第三步:以下表 根据 ListingProductID 不在RB_Ebay_Listing_Product_V2 表中 可归档
select top 10 * from RB_Ebay_Listing_Image_V2
-- 以下表 定时归档 保留 6个月
select top 10 * from RB_Ebay_ErrorMessage
select top 10 * from RB_Ebay_Listing_Promotion_Log