diesel-rs/diesel

Experiment with generate `allow_columns_to_appear_in_same_group_by_clause!` via `diesel print-schema`

Open

#2,555 创建于 2020年11月5日

在 GitHub 查看
 (2 评论) (5 反应) (0 负责人)Rust (12,054 star) (1,003 fork)batch import
clidiscussion desiredgood first issuehelp wantedmentoring available

描述

#2549 introduced the allow_columns_to_appear_in_same_group_by_clause! macro that allows you to use more than one column in your group by clause. It opted not to generate a call to this macro for all columns in the schema via diesel print-schema due to compile time concerns. I would like to see some experimentation and some concert numbers for the actual compile time impact of this. As I think that's a good first issue, I will writeup some steps for someone willing to work on this:

  1. Similar to allow_tables_in_same_query! here we want to generate a call to allow_columns_to_appear_in_same_group_by_clause!. All required data are contained in self.tables. We need to iterate over all tables and all columns for each table and generate the corresponding macro call there.
  2. Test the impact on compile time of the generated schema.
    • That means get/generate a database with a large number of tables and columns (probably something that has >1000 columns or so).
    • Generate a schema.rs with the change in 1. applied
    • Generate a schema.rs without the change in 1. applied
    • Check and writedown the from scratch debug and release compile time for both variants. Also the incremental compile time without any change to the schema.rs module (but to some other module) may be interesting.
  3. Comment those numbers here, discuss if they are a acceptable hit

贡献者指南