使用Invantive查询工具中的精确在线查询时出现超时错误?

时间:2017-01-25 14:17:35

标签: sql exact-online invantive-query-tool

我正在使用此查询:

select * 
from   MailMessagesReceived mmd
inner  
join   MailMessageAttachments mmt
on     mmd.ID = mmt.ID
Where  mmd.created > '2017-01-01'
And    mmd.SenderMailbox = 'finappanl@lyanthe.com'
And    mmd.RecipientStatusDescription = 'Prepared'

我没有消息代码就得到了超时错误。它写着“Er is e out time out opgetreden voor de bewerking。”以下详细信息附在错误上:

select * from MailMessagesReceived
inner join MailMessageAttachments
on MailMessagesReceived.ID = MailMessageAttachments.ID
Where MailMessagesReceived.created > "2017-01-01"
And MailMessagesReceived.SenderMailbox = "finappanl@lyanthe.com"
And MailMessagesReceived.RecipientStatusDescription = "Prepared"

Type: System.Net.WebException
bij System.Net.HttpWebRequest.GetResponse()
bij Invantive.Data.ODataProvider.DoRequest(HttpWebRequest request, String url, String partition, String& returnUrl, Dictionary`2& headers) in File161:regel 3666
bij Invantive.Data.ODataProvider.GetInternal(String relativeUrl, String mimeType, String partition, Boolean allowFromCache, String& returnUrl, Dictionary`2& headers, Boolean& fromCache) in File161:regel 3001
bij Invantive.Data.ODataProvider.Get[T](String relativeUrl, Dictionary`2& headers, String& fullUrl, Boolean& resultFromCache, String partition, Boolean allowFromCache, String mimeType) in File161:regel 2880
bij Invantive.Data.ODataProvider.ReadDataFromServiceResponse(List`1 rows, String basePath, List`1 allFieldTypes, String url, String partition, ObjectDefinition objectDefinition, QueryObject queryObject, Int32& pagesRetrieved, Int32& rowsRetrieved) in File161:regel 1102
bij Invantive.Data.ODataProvider.FetchDataOnePartition(String serviceUrl, String partition, List`1 rows, String basePath, List`1 allFieldTypes, ObjectDefinition objectDefinition, QueryObject queryObject, ParameterList parameters) in File161:regel 1021
bij Invantive.Data.ODataProvider.<>c__DisplayClass72_3.<Fetch>b__2(String partition) in File161:regel 877
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
bij Invantive.Data.ODataProvider.Fetch(EntityFieldCollection entityFields, QueryObject queryObject, ParameterList parameters, Boolean fetchSingle, Boolean fetchCountFirst, Int32 pagingSteps, Boolean fetchCount, ResultSet& resultSet, Int32& totalNumberOfRows) in File161:regel 914
bij Invantive.Data.ExactOnlineProvider.Fetch(EntityFieldCollection entityFields, QueryObject queryObject, ParameterList parameters, Boolean fetchSingle, Boolean fetchCountFirst, Int32 pagingSteps, Boolean fetchCount, ResultSet& resultSet, Int32& totalNumberOfRows) in File298:regel 909
bij Invantive.Data.ConnectionManager.ExecuteProviderFetch(EntityFieldCollection entityFields, QueryObject queryObject, ParameterList parameters, Boolean fetchSingle, Boolean fetchCountFirst, Int32 pagingSteps, Boolean fetchCount, Int32& totalNumberOfRows, String& handlingPath) in File39:regel 3190
bij Invantive.Data.ConnectionManager.Fetch(EntityFieldCollection entityFields, QueryObject queryObject, ParameterList parameters, Boolean fetchSingle, Boolean fetchCountFirst, Int32 pagingSteps, Boolean fetchCount) in File39:regel 1406
bij Invantive.Sql.DataSourceOrFunctionTree.<GetDataFromDataContainer>d__29.MoveNext() in File120:regel 315
bij System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
bij System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
bij Invantive.Sql.FirehoseResultSet.<Iterator>d__54.MoveNext() in File133:regel 547
bij System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
bij System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
bij Invantive.Sql.FirehoseResultSet.<Iterator>d__54.MoveNext() in File133:regel 559
bij System.Linq.Buffer`1..ctor(IEnumerable`1 source)
bij System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
bij Invantive.Sql.JoinIterator.<JoinInternal>d__13.MoveNext() in File135:regel 481
bij Invantive.Sql.FilterIterator.<Iterator>d__3.MoveNext() in File132:regel 92
bij Invantive.Sql.ChainedFirehose.<Iterator>d__11.MoveNext() in File130:regel 81
bij Invantive.Sql.SelectListIterator.<Iterator>d__7.MoveNext() in File138:regel 119
bij System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
bij System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
bij Invantive.Sql.QueryPlan.Fetch() in File140:regel 91
bij Invantive.Data.ConnectionManager.ExecuteProviderPassthroughSqlActionTable(String actionSql, ParameterList parameters, String& handlingPath) in File39:regel 4033
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
bij System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bij Invantive.Data.ConnectionManager.ExecuteProviderPassthroughSqlActionTable(String actionSql, ParameterList parameters, String& handlingPath) in File39:regel 4062
bij Invantive.Data.ConnectionManager.PassthroughSqlActionTable(String actionSql, ParameterList parameters) in File39:regel 2086
--- Einde van stacktracering vanaf vorige locatie waar uitzondering is opgetreden ---
bij System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bij Invantive.Data.ConnectionManager.PassthroughSqlActionTable(String actionSql, ParameterList parameters) in File39:regel 2098
bij Invantive.Data.ActionProceduresBase.PassthroughSqlActionTable(String actionSql, ParameterList parameters) in File29:regel 134
bij Invantive.Producer.Windows.Forms.QueryTool.ExecuteStatement(IProgressNotifier notifier, String statement, ParameterList bindVariables, Boolean showResultsInGrid, Boolean showStatistics, Boolean memorizeStatisticsInSqlHistory, Boolean allowPaging) in File948:regel 2847
bij Invantive.Producer.Windows.Forms.QueryTool.FetchResultsFromSql() in File948:regel 2430

我正在尝试在Exact Online中概述“Scan en Herken”(即扫描和识别发票)收件箱。此收件箱包含发票和计算机生成的帐户条目,每个条目都是:

  • 准备好处理(绿色),
  • 需要一些改动(黄色)
  • 或需要处理mannualy(红色)。

我们想要具体了解这三种不同状态中每种状态的发票数量。对于那些需要改动或手动修正的人,我们想知道错误是什么。

通过我正在使用的查询,我只是在挖掘以找出MailMessageAttachments表中包含的数据。我不知道我是否正在挖掘正确的地方,所以关于这个问题的任何建议都会很好。此外,我想知道为什么我的SQL代码会暂时停止。

1 个答案:

答案 0 :(得分:1)

有一些可能的改进。最近,Exact Online的REST API邮件消息(JSON)经过重组后表现更好,但仍然不是最快的。

请首先确保您只选择要使用的部门,例如使用:

use 123456,345678,56789

而不是使用:

use all

从一个带有一些示例数据的小部门开始,当查询工作时通过在较大的部门上测试来提高性能。

此外,您可能希望确保不会发生隐式数据类型转换,因此首选:

date-field > to_date('20170101', 'yyyymmdd')

date-field > '2017-01-01'

在这个查询中,它可能不会受到伤害。

最好查询状态代码而不是描述。描述因国家/地区甚至每个用户而异。并且代码可能已被索引,而可翻译的描述则没有。

此外,并非所有邮件都有附件,因此最好使用左外连接。

此外,MailMessageAttachments表可以是一个巨大的表(许多文档包含在二进制格式中,特别是当人们使用灰度或彩色扫描仪时)。每行可以下载多个兆字节,因此最好只在绝对需要时加入它。

最后,在使用“top”或“limit”语法检索了有限数量的行之后,您可以让查询停止运行。

结果查询:

select * 
from   MailMessagesReceived mmd
left 
outer
join   MailMessageAttachments mmt
on     mmd.ID = mmt.ID
Where  mmd.created > to_date('20170101', 'yyyymmdd')
And    mmd.SenderMailbox = 'Facturen@ExactOnline.nl' --     'finappanl@lyanthe.com'
and    mmd.recipientstatus = 20 /* Open. Etc, look up for Prepared. Enables index use. */
limit 50

使用set requests-parallel-max 8在30个小分区上运行时,该行大约需要1分钟。

PS。请注意,您可以使用select * from exactonlinerest..sessionios找到实际的REST和XML URL调用及其持续时间。