0

sorry for my English, I write through Google translator.

I use cratedb and PHP. I have a table (cakes) in crate, that currently has 1 million records.

For part of the records, I want to do an update on a condition on column lastmode. Do select to an existing page on my site and update to multiple threads. In this crate with the server fall down (502 error).

My connection:

require_once '/var/www/remaru/data/vendor/autoload.php';    
$opt = array (
    'driverClass' => 'Crate\DBAL\Driver\PDOCrate\Driver',
    'host' => 'localhost',
    'port' => 4200
);
$params['connection'] = \Doctrine\DBAL\DriverManager::getConnection( $opt );
return $params;

Update:

$query = 
    "update cakes set str='". $params['cache']['data'] 
    ."', tpl='". $params['cache']['tpl'] 
    ."', lastmod='". $cur_time 
    ."' where url='". $url ."'";
$params['addons/system/db'] -> query( $params['connection'] , $query );

At the same time I have no difficulties with the update in 1 stream. How to make a mass update in several threads at the same time? In 1 stream, the next 10 million records will be processed forever...

GMB
  • 216,147
  • 25
  • 84
  • 135
remaru
  • 1
  • Multi-threading does not look like a good option for your use case. You would better try to leverage your database engine by optimizing your sql query. Do you have an index on column `lastmod` ? – GMB Dec 22 '18 at 22:48
  • I understand. Test on the second server OK. Problems with the settings of the first server. – remaru Dec 26 '18 at 16:31
  • I agree with GMB, why not just issue this query via crate UI, or does it have to run from your code? It seems like a trivial operation. You are updating on 'url' column but your question mentions 'lastmod'? – metase Dec 29 '18 at 00:36

0 Answers0