B
B
baimkin2019-01-21 18:27:06
SQLite
baimkin, 2019-01-21 18:27:06

Is UPDATE taking too long?

SQLITE base.
There is a table with a query in it, the id column, and a table with results in which there is an id from the first table, you need to update the column in the first table and record the number of repetitions of each id in the second table.
Schematically, it looks like this:
5c45e435f1527605585247.jpeg
I made this kind of query, but it takes a very long time (23 seconds, 5000 rows in each table):

UPDATE [queries]
   SET [queries].[rezult] = 
       (SELECT COUNT( * ) FROM [searchRezult] WHERE [searchProdId] = [queries].[id])
 WHERE [queries].[id] = 
       (SELECT [searchProdId] FROM [searchRezult] WHERE [searchProdId] = [queries].[id]);

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question