On Friday, July 27, 2018 at 2:42:42 PM UTC+2, Georgios Petasis wrote:
> If I do:
>
> tdbc::mysql::connection create $db ...
> foreach entry [$db allrows -as lists -- "SELECT * FROM `entry` WHERE e1
> IS NOT NULL"] {
> }
>
> takes a few seconds (and ~2.4GB or RAM) to complete.
>
> But if I use:
>
> $db foreach -as dicts entry SELECT * FROM `entry` WHERE e1 IS NOT NULL" {
> }
>
> it takes ages (hours).
=timing=
Sounds like the problem is huge. So there is no need to be smart about timing to get the quantity: puts stderr [clock microseconds] inside the loop (or twice at start and end of your code, to decide whether the delay is in your code or in the db package).
=possible reasons=
Constructing separate dicts per row in the package?
Your code? Is the above your very code? Did you use a version with uplevel inside the loop? Logging dicts?
I once had a shimmering problem when writing all state dicts of a state machine to a debug log file. It turned out that the culprit was not reading and writing of sub-dicts of a huge dict, but getting the string representation of that possibly modified huge dict. (Obvious with some knowledge of Tcl's internals.)
=btw, return sanity=
You might want to add [dict incr options -level] before passing it on.