UBarney commented on PR #16889:
URL: https://github.com/apache/datafusion/pull/16889#issuecomment-3121216474

   > > I'll need some time to read through the code, but reduced memory usage 
is also impressive 👍
   > > 
   > > * v1 (old)
   > > 
   > > ```
   > > Query     Time (ms)     Peak RSS  Peak Commit  Page Faults
   > > --------------------------------------------------------------
   > > 1            657.40    1112.0 MB      10.6 GB            0
   > > 2            833.66    1691.1 MB      10.6 GB            0
   > > 3           1688.13       3.4 GB      10.8 GB            0
   > > 4           4176.38      16.2 GB      20.1 GB            0
   > > 5           1629.22      23.2 GB      57.2 GB            0
   > > 6          17687.00      18.9 GB      26.1 GB            0
   > > 7           1245.64      23.3 GB      39.2 GB            0
   > > 8          19420.73      20.1 GB      31.3 GB            0
   > > 9           3467.28      10.4 GB      19.9 GB            0
   > > 10          5414.65      44.7 GB      46.0 GB            0
   > > ```
   > > 
   > > 
   > >     
   > >       
   > >     
   > > 
   > >       
   > >     
   > > 
   > >     
   > >   
   > > 
   > > * v2 (nlj-rewrite-tmp)
   > > 
   > > ```
   > > Query     Time (ms)     Peak RSS  Peak Commit  Page Faults
   > > --------------------------------------------------------------
   > > 1            383.61     104.4 MB       5.0 GB            0
   > > 2            645.60     471.2 MB       8.0 GB            0
   > > 3            763.10    1738.5 MB       6.0 GB            0
   > > 4           1973.21       5.9 GB       9.6 GB            0
   > > 5            644.86     145.1 MB       4.0 GB            0
   > > 6           6043.58     149.3 MB       2.0 GB            0
   > > 7            543.70     154.5 MB       7.0 GB            0
   > > 8           6516.91     177.4 MB       4.0 GB            0
   > > 9           1571.97     140.4 MB       6.0 GB            0
   > > 10          3098.54      22.8 GB      26.9 GB            0
   > > ```
   > > 
   > > 
   > >     
   > >       
   > >     
   > > 
   > >       
   > >     
   > > 
   > >     
   > >   
   > > I ran `cargo run --profile release-nonlto --bin mem_profile nlj` in 
https://github.com/ding-young/datafusion/tree/nlj-rewrite-tmp-review and 
adjusted v1/v2 with `static USE_NLJ_V2: bool = false;`
   > 
   > Thanks for the profiler 👍🏼 I'll review that soon.
   > 
   > I think Q4 and Q10 should not consume that much memory 😅
   > 
   > ```sql
   > -- q10:
   > SELECT *
   >         FROM range(30000) AS t1
   >         FULL JOIN range(30000) AS t2
   >         ON (t1.value + t2.value) % 10 <> 0;
   > ```
   > 
   > It is supposed to only buffer (30k x 8Bytes), 20G RSS is not expected. let 
me double check the implementation...
   
   
   
   @ding-young  For q10, the maxRSS I got using `/usr/bin/time -v` is lower 
than yours (16712272kb vs 44.7 GB).
   
   The code for `./target/release/join_limit_join_batch_size` should be 
identical to the "v1 (old)" code.
   
   
   ```
   √ devhomeinsp  ~/c/datafusion > /usr/bin/time -v  
./target/release/join_limit_join_batch_size --maxrows 1 -c '        SELECT *
           FROM range(30000) AS t1
           FULL JOIN range(30000) AS t2
           ON (t1.value + t2.value) % 10 <> 0;'
   DataFusion CLI v48.0.0
   +-------+-------+
   | value | value |
   +-------+-------+
   | 0     | 24576 |
   | .             |
   | .             |
   | .             |
   +-------+-------+
   810000000 row(s) fetched. (First 1 displayed. Use --maxrows to adjust)
   Elapsed 4.202 seconds.
   
           Command being timed: "./target/release/join_limit_join_batch_size 
--maxrows 1 -c         SELECT *
           FROM range(30000) AS t1
           FULL JOIN range(30000) AS t2
           ON (t1.value + t2.value) % 10 <> 0;"
           User time (seconds): 9.26
           System time (seconds): 4.74
           Percent of CPU this job got: 322%
           Elapsed (wall clock) time (h:mm:ss or m:ss): 0:04.34
           Average shared text size (kbytes): 0
           Average unshared data size (kbytes): 0
           Average stack size (kbytes): 0
           Average total size (kbytes): 0
           Maximum resident set size (kbytes): 16712272
           Average resident set size (kbytes): 0
           Major (requiring I/O) page faults: 0
           Minor (reclaiming a frame) page faults: 3028619
           Voluntary context switches: 72488
           Involuntary context switches: 28
           Swaps: 0
           File system inputs: 0
           File system outputs: 0
           Socket messages sent: 0
           Socket messages received: 0
           Signals delivered: 0
           Page size (bytes): 4096
           Exit status: 0
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to