Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Performance NHibernate排序性能_Performance_Nhibernate_Nhibernate.search_Nhibernate Criteria_Database Performance - Fatal编程技术网

Performance NHibernate排序性能

Performance NHibernate排序性能,performance,nhibernate,nhibernate.search,nhibernate-criteria,database-performance,Performance,Nhibernate,Nhibernate.search,Nhibernate Criteria,Database Performance,我在排序的查询上遇到一些负面性能 以下是NHibernate生成和呈现查询的方式: SELECT TOP 50 y0_, y1_ FROM **(SELECT distinct r1_.Id as y0_, this_.Id as y1_, ROW_NUMBE

我在排序的查询上遇到一些负面性能

以下是NHibernate生成和呈现查询的方式:

SELECT   TOP 50 y0_,
                y1_
FROM     **(SELECT distinct r1_.Id                         as y0_,
                          this_.Id                       as y1_,
                          ROW_NUMBER()
                            OVER(ORDER BY this_.Id DESC) as __hibernate_sort_row
          FROM   Event this_
                 inner join Registration r1_
                   on this_.Id = r1_.EventId
          WHERE  this_.IsDeleted = 0 /* @p2 */
                 and this_.SportId in (22 /* @p3 */)) as query**
WHERE    query.__hibernate_sort_row > 20
ORDER BY query.__hibernate_sort_row;
**符号中的粗体部分获取所有结果并将其按顺序排列-这需要时间。 有什么方法可以让这个查询更有效吗?我只是想让排序和分页成为可能,而不必产生太多的开销

我使用的是NHibernate2.1。未来版本中与我的问题相关的任何改进

致以最良好的祝愿,
Mattias

通过数据库优化顾问运行查询,很可能是缺少索引或索引不正确。

我在查询中没有看到任何我认为性能糟糕的特定内容,您是否通过Optimizer运行查询以查看是否缺少索引?这是索引问题。谢谢不客气,我会把它作为答案贴出来的。