Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have the following MySQL Query that when executed in my aspx page, yields a connection timeout error - the connection timeout is 15 which is the problem but I can not change it - have tried changing mysql ini settings but no difference - if I run it in SQLYOG it takes 20 to 30 seconds to complete - anyone got any ideas:-

Dim Conn As New MySqlConnection(ConfigurationManager.ConnectionStrings("Conn").ConnectionString)

    Dim mysql As String = "DROP TABLE IF EXISTS ctemp1; CREATE TEMPORARY TABLE ctemp1 SELECT u.`user_id`,u.`user_username`,u.location,(SELECT COUNT(*) FROM users uu WHERE uu.`location`=u.location AND uu.role='Level 6' AND uu.corp_id=1) AS loc_count ,(SELECT COUNT(pp.project_id) FROM projects pp WHERE pp.project_id=u.user_id AND pp.corp_id=1 AND (pp.description<>'' OR pp.impact_and_metrics<>'' OR pp.interests<>'' ) ) AS numprofiles  FROM users u WHERE u.`role`='Level 6' AND u.`corp_id`=1 AND (u.location<>'none' or u.`location`<>'unassigned') ORDER BY u.`location` ; DROP TABLE IF EXISTS ctemp2; CREATE TEMPORARY TABLE ctemp2 SELECT location,loc_count,SUM(numprofiles) AS numprofiles, CONCAT(CAST(ROUND(((SUM(numprofiles)/loc_count)*100),2) AS CHAR(10)),'%') AS percentage FROM ctemp1 cc GROUP BY location; SELECT SUM(loc_count) AS loc_count,SUM(numprofiles) AS numprofiles, CONCAT(CAST(ROUND(((SUM(numprofiles)/SUM(loc_count))*100),2) AS CHAR(10)),'%') AS percentage,(SUM(loc_count)-SUM(numprofiles)) AS thediff,((SUM(loc_count)-SUM(numprofiles))/100) AS thediff2,(SUM(numprofiles) /100) AS numprofiles2  FROM ctemp2;"

    Dim da As New MySqlDataAdapter(mysql, Conn)
    Dim dt As New DataTable
    Conn.Open()
    da.Fill(dt)
    Dim mytask As DataRow() = dt.[Select]
    If dt.Rows.Count > 0 Then
        For Each dr As DataRow In mytask
            mys = "http://chart.apis.google.com/chart?cht=p3&chs=700x240&chd=t:" & dr("numprofiles2").ToString.Trim & "," & dr("thediff2").ToString.Trim & "&chl=No. of Profiles filled-in (" & dr("numprofiles").ToString.Trim & ")|No. of Profiles not filled-in (" & dr("thediff").ToString.Trim & ")&chtt=Grosvenor (" & dr("percentage").ToString.Trim & ")&chco=1a296b&chf=bg,s,ffffff&chco=1a296b,3751b8&chts=1a296b,13&chxs=0,000000,11&chxt=x"
        Next
    End If
   da = Nothing
    Conn.Close()
    Conn.Dispose()
    Conn = Nothing
    dt = Nothing

Thanks

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.