Hi Petr,
> I hope someone can help me with the following problem: I have a table
> containing integer counters associated with particular datetime like this:
>
> CREATE TABLE `counters` (
> ...
> `when` datetime NOT NULL default '0000-00-00 00:00:00',
> `counter` smallint(5) unsigned NOT NULL default '0',
> ...
> );
>
> For some purposes I need to initialize frequently the table for time
> sequences with constant time step e.g. since 2003-11-06 8:00 to
> 2003-11-06 12:00 with time step 15 minutes. It means I need to do
> following INSERT commands:
>
> INSERT INTO couters (..., '2003-11-06 8:00', 0, ...);
> INSERT INTO couters (..., '2003-11-06 8:15', 0, ...);
> INSERT INTO couters (..., '2003-11-06 8:30', 0, ...);
> ...
> INSERT INTO couters (..., '2003-11-06 12:00', 0, ...);
>
> Of course my C code is able to generate such command strings in one
> simple loop and send them to the MySQL server. But the code should be
> as fast as possible and I prefer to do this task by one INSERT-SELECT
> command like this:
>
> INSERT INTO counters SELECT ...
As fast as possible? How many rows do you need to create then? Is
this a process that needs to be done several times?
'Cause I can do this kind of stuff very easily with my Test Data Generator
tool that comes with Database Workbench.
With regards,
Martijn Tonies
Database Workbench - developer tool for InterBase, Firebird & MS SQL Server.
Upscene Productions
http://www.upscene.com