You are viewing limited content. For full access, please sign in.

Question

Question

Long wait times for Query to complete causing slowness exporting

asked on January 27, 2016

(@P1 int,@P2 int,@P3 varbinary(85),@P4 varbinary(85),@P5 int,@P6 int)
SELECT ann.page_id, 
   pagenum, 
   ann_id, 
   item_id, 
   ann_type, 
   ann_creator, 
   ann_created, 
   ann_lastmod, 
   ann_comment, 
   pos1, 
   pos2, 
   pos3, 
   pos4, 
   pos5, 
   pos6, 
   rotation, 
   direction, 
   color1, 
   color2, 
   color3, 
   thickness, 
   opacity, 
   style1, 
   style2, 
   style3, 
   stamp_id, 
   bitmap, 
   attach_mime, 
   attach_size, 
   attach_etag, 
   attach_filename, 
   attach_storeid, 
   attach_encrypt, 
   attach_compress, 
   attach_cksum, 
   ann_text, 
   ann_textsize, 
   keephist, 
   protect, 
   private, 
   ann_access, 
   data1, 
   zorder, 
   CASE 
      WHEN ann_type = 8 THEN 
         (
         SELECT count(*) 
         FROM annhist 
         WHERE annhist.ann_id = ann.ann_id
         ) 
      ELSE 1 
   END 
FROM ann 
JOIN doc 
ON ann.page_id = doc.page_id 
WHERE tocid = @P1 
AND pagenum >= 0 
AND doc.pagenum=@P2 
AND (private = 0 
OR ann_creator = @P3) 
AND (ann_access = 0 
OR ann_creator = @P4 
OR (ann_access = 1 
AND exists 
   (
   SELECT * 
   FROM annaccess 
   WHERE annaccess.ann_id = ann.ann_id 
  AND annaccess.sid in 
      (
      SELECT sid 
      FROM sess_sid 
      WHERE sess_id = @P5
      )
   )) 
OR (ann_access = 2 
AND not exists 
   (
   SELECT * 
   FROM annaccess 
   WHERE annaccess.ann_id = ann.ann_id 
  AND annaccess.sid in 
      (
      SELECT sid 
      FROM sess_sid 
      WHERE sess_id = @P6
      )
   ))) 
ORDER BY doc.pagenum, 
   item_id

0 0

Replies

replied on January 27, 2016

We have been troubleshooting an issue with someslowness in exporting some documents and noticed the query above taking a log time to complete. We believe its a query to retrieve annotations on a document before an export is done but would like confirmation before continuing to troubleshoot in that direction. Can someone from Dev confirm this for us? Thank you!

0 0
replied on February 3, 2016

It's a query to retrieve annotation data for a document.

0 0
replied on February 10, 2016

Thank you Michael for your reply. Could you confirm when this query runs?

Is it before an export?

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.