asp.net - Slow performance when using Paged Fetch -


i executing sql query using petapoco return around 4000 rows.

here code builds sql:

var sql = petapoco.sql.builder .append("select ") .append("participants.participantid") .append("from participants") .append("inner join organizations") .append("on participants.orgid = organizations.orgid") .append("left join departments") .append("on participants.departmentid = departments.departmentid") .append("where") .append("participants.orgid = @0", 6328); .append("and participants.last_name @0", "p%"); .append("and ") .append("participants.orgid in ") .append("              (") .append("                 select") .append("                     orgid ") .append("                 ") .append("                     organizations") .append("                 where") .append("                     associationid = @0", 318) .append("              )"); 

if pull entire recordset , use linq page results, page renders in 250ms. here code:

    list<participantvmitem> pagedresult = null;     var fullresult = db.fetch<participantvmitem>(sql);     pagedresult = fullresult.skip((pageno - 1) * pagesize).take(pagesize).tolist(); 

if try use paging feature built petapoco, page takes on 4200ms render. here code:

            list<participantvmitem> pagedresult = null;             pagedresult = db.fetch<participantvmitem>(4, 250, sql); 

what's odd glimpse , sql profiler show me actual sql commands running in either case take approximately same length of time. glimpse suggests in second case delay takes place before connection gets opened. can explain behavior?

more information: i'm running sql server 2008r2

there issue petapoco paging regex. becomes issue on long sqls others can affected.

this can fixed replacing rxorderby regex with

public static regex rxorderby = new regex(@"\border\s+by\s+(?:\((?>\((?<depth>)|\)(?<-depth>)|.?)*(?(depth)(?!))\)|‌​[\w\(\)\.\[\]""])+(?:\s+(?:asc|desc))?(?:\s*,\s*(?:((?>((?<depth>)|)(?<-depth‌​>)|.?)*(?(depth)(?!)))|[\w()\.[]""])+(?:\s+(?:asc|desc))?)*", regexoptions.ignorecase | regexoptions.multiline | regexoptions.singleline | regexoptions.compiled);

or using npoco, enhanced fork of petapoco api compatibility.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -