Menu

Slow Persistence Broker Initalisation

Ian B
2005-05-06
2013-03-07
  • Ian B

    Ian B - 2005-05-06

    Hi,

    When Initalising the persistence broker on a MySQL database, I found it to be very slow. I changed the function getTableSchema in AF_MySQL to add a clause "WHERE 0 = 1" so that no rows are returned.

    Is this likely to cause problems elsewhere? and is it something that can be added to a later release?

    Public Function getTableSchema(ByVal tName As String) As System.Data.DataTable Implements IConnection.getTableSchema
            Dim statement As String
            Dim cmd As MySqlCommand
            Dim dr As MySqlDataReader
            Dim dt As DataTable

        statement = "select * from " & tName & " WHERE 0 = 1"
            Try
                cmd = New MySqlCommand(statement, Me.Connection)
                dr = cmd.ExecuteReader(CommandBehavior.SchemaOnly)
                dt = dr.GetSchemaTable
            Catch ex As Exception
                dt = Nothing
                Throw ex
            End Try
            Return dt
        End Function

     
    • Richard Banks

      Richard Banks - 2005-05-07

      It should cause no problems.

      The reader is only getting the schema of the tables, and should not actually return any records.

      It seems like the statement is still getting executed which is why it's slow for you.  I don't know if thats a behaviour just with the MySql ADO.NET provider or if it's consistent across all providers - I'll have to check.

      - Richard.

       

Log in to post a comment.