Unsupported Screen Size: The viewport size is too small for the theme to render properly.

Slow Import External Data From Ms-Sql View

forums forums SQLyog Sync tools, Migration, Scheduled Backup and Notifications Slow Import External Data From Ms-Sql View

  • This topic is empty.
Viewing 7 reply threads
  • Author
    Posts
    • #11847
      noblenull
      Member

      I am attempting to sync a MS-SQL database with a MySQL database using the SQLyog Import External Data Wizard. I've created a view in MS-SQL, and am doing a “SELECT * ” query on that view in SQLyog. The problem seems to be caused by a LEFT OUTER JOIN in the view query, when I remove this the query runs with no problem.

      When I add the LEFT OUTER JOIN, the query runs in under 1 second in MS-SQL Management Studio on the same PC. I've also run the same query in Excel, using the same ODBC connection, and it completes immediately. When I run the job in SQLyog, it takes 27 minutes to complete the sync.

      Any tips? Is there a problem with the way SQLyog handles the LEFT OUTER JOIN?

      Code:
      SELECT TOP (100) PERCENT i.ITEM_ID, i.ORDERNO, i.ITEM,
      i.QUANTO, i.QUANTS, i.QUANTB, s.DESC1 + ' ' + s.DESC2 AS description,
      i.DROPSHIP, i.ITEM_STATE, pi.EXPECT_ON
      FROM MailOrderManager.dbo.ITEMS AS i INNER JOIN
      MailOrderManager.dbo.STOCK AS s ON i.ITEM = s.NUMBER LEFT OUTER JOIN
      MailOrderManager.dbo.PURITEM AS pi ON i.ITEM_ID = pi.ITEM_ID
      WHERE (i.ORDERNO > 200000)
    • #30375
      peterlaursen
      Participant

      SQLyog does not 'know' the query used for populating the VIEW.  Bascially SQLyog will just SELECT * … for every table (or VIEW). Even if you use the option to 'specify a query' in SQLyog the query is sent to to theserver (ie. SQL server) who returns a result set. SQLyog creates a table on (ie MySQL) and populates this table with the result set. 

      So this is strange – also as Excel loads the VIEW very fast it does not seem to be an problem with ODBC either.

      Please tell:

      1) Are the machines on the same network or are you importing over the Internet? 

      2) How big is that VIEW? (#of rows, the data length for the table in MySQL after import as returned by SHOW TABLE STATUS)

      3) Can you try creating a table on source with the same data and next import just to see if it makes any difference  (not sure about SQL Server syntax but there must be something like CREATE TABLE … AS SELECT …)

      If it is not a networking issue or a MySQL configuratiobn issue I am afraid we will need a complete test case with data to comment further (access to the database or a copy). Can you provide that?  And please create a support ticket for privacy when exchanging such details.

    • #30376
      noblenull
      Member
      'peterlaursen' wrote on '27:

      1) Are the machines on the same network or are you importing over the Internet? 

      The MS-SQL source database is on the same network, the MySQL destination is over the internet. However, I can run other similar sized exports over this connection without any issues.

      'peterlaursen' wrote on '27:

      2) How big is that VIEW? (#of rows, the data length for the table in MySQL after import as returned by SHOW TABLE STATUS)

      Rows 33060, Data Length 5429504, MyISAM

      'peterlaursen' wrote on '27:

      3) Can you try creating a table on source with the same data and next import just to see if it makes any difference  (not sure about SQL Server syntax but there must be something like CREATE TABLE … AS SELECT …)

      After creating a table from the view, the import completes in 40 seconds with compression on (I've tried with it on and off).

      'peterlaursen' wrote on '27:

      If it is not a networking issue or a MySQL configuratiobn issue I am afraid we will need a complete test case with data to comment further (access to the database or a copy). Can you provide that?  And please create a support ticket for privacy when exchanging such details.

      I may be able to provide this, but would have to sanitize the data.

    • #30377
      peterlaursen
      Participant

      OK .. somebody with better insight to ODBC than me will have to look into this!

    • #30378
      noblenull
      Member
      'peterlaursen' wrote on '27:

      OK .. somebody with better insight to ODBC than me will have to look into this!

      Peter,

      Any update on this?

      Thank you.

    • #30379
      Khushboo
      Member

      Hi Noble,

      We are looking into this issue with high priority.

      We reproduced your case at our end.

      The issue is with views containing OUTER and INNER JOINS and with large data.

      We will update the status soon.

      Thanks & Regards,

      Khushboo

    • #30380
      noblenull
      Member
      'Khushboo' wrote on '03:

      The issue is with views containing OUTER and INNER JOINS and with large data.

      This problem also occurs when querying the tables directly, without the use of the view.

    • #30381
      Khushboo
      Member

      Hi Noble,

      We are looking into this issue, in the mean while can you please check that the tables which you are importing consists of primary keys or not?

      Usually importing tables without primary keys and large data, is slow with ODBC driver.

      We checked the same case for tables with primary keys, both tables and views(with primary key columns) are importing fast.

      Please use primary keys for your tables and try to import tables and views through Import External Data.

      Regards,

      Khushboo

Viewing 7 reply threads
  • You must be logged in to reply to this topic.