Project

General

Profile

« Previous | Next » 

Revision 9408

Added by Jing Tao about 9 years ago

Add more statement to debug the query performance.

View differences:

src/edu/ucsb/nceas/metacat/EventLog.java
519 519

  
520 520
        // select the count
521 521
        String countQuery = countClause + queryWhereClause.toString();
522
        
522
        logMetacat.debug("The count query is "+countQuery);
523 523
		// select the fields
524 524
        String pagedQuery = DatabaseService.getInstance().getDBAdapter().getPagedQuery(fieldsClause + queryWhereClause.toString() + orderByClause, start, count);
525
        logMetacat.debug("The selection query is "+pagedQuery);
526
        logMetacat.debug("The startDate in the query is "+startDate);
527
        logMetacat.debug("The endDate in the query is "+startDate);
525 528

  
526 529
        DBConnection dbConn = null;
527 530
        int serialNumber = -1;
......
557 560

  
558 561
            // get the fields form the query
559 562
            if (count != 0) {
563
                long startTime = System.currentTimeMillis();
564
                logMetacat.debug("Time to start to execute the selection query "+startTime);
560 565
	            fieldsStmt.execute();
566
	            long endTime = System.currentTimeMillis();
567
	            logMetacat.debug("Time to run the selection query is "+(endTime-startTime)/1000+" seconds.");
561 568
	            ResultSet rs = fieldsStmt.getResultSet();
562 569
	            //process the result and return it            
563 570
	            while (rs.next()) {
......
590 597
					logs.add(logEntry);
591 598
	            }
592 599
	            fieldsStmt.close();
600
	            long endTime2 = System.currentTimeMillis();
601
	            logMetacat.debug("Time to put the query result to the log is "+(endTime2-endTime)/1000+" seconds.");
593 602
            }
594 603
            
595 604
            // set what we have
......
599 608
            			
600 609
			// get total for out query
601 610
		    int total = 0;
611
		    long startTime = System.currentTimeMillis();
612
            logMetacat.debug("Time to start to execute the counting query "+startTime);
602 613
            countStmt.execute();
614
            long endTime = System.currentTimeMillis();
615
            logMetacat.debug("Time to run the counting query is "+(endTime-startTime)/1000+" seconds.");
603 616
            ResultSet countRs = countStmt.getResultSet();
604 617
            if (countRs.next()) {
605 618
            	total = countRs.getInt(1);

Also available in: Unified diff