Answer the question
In order to leave comments, you need to log in
How to make a quick fetch and create a new sql database?
There is a database of 10 million rows running mySQL.
Based on the current database, it is necessary to create a new database with a size of 500 thousand to 1 million (random value in this interval) rows with random rows of the primary database.
Primary base structure:
1. Id
2. Varchar(500)
The second column contains text.
The structure of the new database:
1. Id
2. Varchar(500)
3. Varchar(500) The
first two columns are identical to the columns from the primary database. The third column contains the string from the second column in transliteration.
Those. for example, the second column contains the text: "buy plastic windows", then the third column will contain the value: "kupit-plastikovie-okna" after the script is processed.
How can you implement this as quickly as possible without putting down the server?
The goal is to speed up this process as quickly as possible.
Thanks in advance for your advice.
Answer the question
In order to leave comments, you need to log in
What you described in the body of the question has nothing to do with what you wrote in the title.
You have a table with 2 fields, and you need a table with 3 fields. What are the options -
1) Add a column where there is
ALTER TABLE table1 add column translit varchar(500) null
UPDATE TABLE table1
set translit = transliterate(text)
WHERE some condition
Your task is to write a scalar function that transliterates text into.
2) Create a new table.
CREATE TABLE table2 (id,text,translit)
INSERT INTO table2
SELECT id,text,transliterate(text)
FROM table1
WHERE some condition.
3)Create a new table and, in a familiar server language, slowly pull out a data block (say, 5000 rows without a table lock), transliterate the desired field and make an insert into a new table.
Any decision will take time, the base should not "fall" but it can slow down. If you are not in a hurry - I would choose the third method. You can do this more smoothly and take data without locking the table
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question