执行查询需要时间

时间:2018-08-08 16:48:21

标签: acumatica

我有一个关于Inventoryitem的扩展表,该表具有100个字段。我编写了一个智能搜索以根据过滤条件显示数据。

拥有25.000条以上记录的项目主记录

要获取所有记录,大约需要3分钟。

public PXSelectOrderBy<
        FilterResult, 
        OrderBy<
            Asc<FilterResult.inventoryID, 
            Asc<FilterResult.recordType>>>> records;

[System.SerializableAttribute()]
[PXTable(typeof(InventoryItem.inventoryID),
   IsOptional = true)]
public class ItemExtendTable : PXCacheExtension<InventoryItem>
{

 }



[PXFilterable]
    public PXSelectJoinGroupBy<
        INSiteStatus, 
        LeftJoin<InventoryItem, 
            On<InventoryItem.inventoryID, Equal<INSiteStatus.inventoryID>>>, 
        Aggregate<
            GroupBy<InventoryItem.inventoryID, 
                Sum<INSiteStatus.qtyOnHand>>>> 
        item;

我正在使用以下语句在数据委托中获取页面数据

protected virtual IEnumerable Records()
    {
        List<object> result = new List<object>();
        List<FilterResult> rows = new List<FilterResult>();
        PXView select = new PXView(this, true, item.View.BqlSelect);
        Int32 totalrow = 0;
        Int32 startrow = PXView.StartRow;
        result = select.Select(PXView.Currents, PXView.Parameters,
               PXView.Searches, PXView.SortColumns, PXView.Descendings,
               PXView.Filters, ref startrow, PXView.MaximumRows, ref totalrow);
        PXView.StartRow = 0;

        foreach (PXResult<INSiteStatus, InventoryItem> res in result)
        {
            InventoryItem item_rec = res;
            ItemExtendTable item_ext = PXCache<InventoryItem>.GetExtension<ItemExtendTable>(item_rec);
            FilterResult ret = new FilterResult();

            // Fill values
            rows.Add(ret);
        }
        return rows;
    }

**

result = select.Select(PXView.Currents, PXView.Parameters,
                       PXView.Searches, PXView.SortColumns, PXView.Descendings,
                       PXView.Filters, ref startrow, PXView.MaximumRows, ref totalrow);

**

上面的语句需要3分钟以上的时间来获取数据。

使用扩展表对BQL查询有影响吗?

更新

我已经运行了配置文件,并且为每个项目触发了SQL语句。它触发了25000多个SQL语句。

0 个答案:

没有答案
相关问题