Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>MySQL will almost always perform better executing straight SQL statements, than looping inside a stored procudure.</p> <p>That said, if you are using InnoDB tables, your procedure will run faster inside a <code>START TRANSACTION</code> / <code>COMMIT</code> block.</p> <p>Even better would be to add an <code>AUTO_INCREMENT</code> to the records in <code>frugg.temp_input</code>, and querying against that table:</p> <pre><code>DROP TABLE IF EXISTS temp_input2; CREATE TABLE temp_input2 ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, shortProductDescription TEXT, longProductDescription TEXT, productID INT, productImageURL TEXT, PRIMARY KEY (id) ); START TRANSACTION; INSERT INTO temp_input2 SELECT NULL AS id, shortProductDescription, longProductDescription, productID, productImageURL FROM frugg.temp_input; INSERT INTO item ( id, short_description, long_description ) SELECT id, shortProductDescription AS short_description, longProductDescription AS long_description FROM temp_input2 ORDER BY id; INSERT INTO item_catalog_map ( catalog_id, catalog_unique_item_id, item_id ) SELECT 1 AS catalog_id, CAST(productID AS CHAR) AS catalog_unique_item_id, id AS item_id FROM temp_input2 ORDER BY id; INSERT INTO item_images ( item_id, original_url ) SELECT id AS item_id, productImageURL AS original_url FROM temp_input2 ORDER BY id; COMMIT; </code></pre> <p>Even better than the above, is before loading the .CSV file into <code>frugg.temp_input</code>, you add an <code>AUTO_INCREMENT</code> field to it, saving you the extra step of creating/loading <code>temp_input2</code> shown above.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload