Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 63f2cbc1

Von Sven Schöling vor fast 12 Jahren hinzugefügt

  • ID 63f2cbc1aeb2051fe9cb34ddc0d39801a9db7346
  • Vorgänger a60b31d7
  • Nachfolger 6cec3677

Anzahl der Zeilen für den Report cachen un indizieren

Da das auch mal gerne 4mio+ werden dauert das sonst elend lange.

Unterschiede anzeigen:

SL/Controller/CsvImport.pm
130 130
  my $report_id = $params{report_id} || $::form->{id};
131 131

  
132 132
  $self->{report}      = SL::DB::Manager::CsvImportReport->find_by(id => $report_id);
133
  my $num_rows         = SL::DB::Manager::CsvImportReportRow->get_all_count(query => [ csv_import_report_id => $report_id ]);
133
  my $num_rows         = $self->{report}->numrows;
134 134
  my $num_cols         = SL::DB::Manager::CsvImportReportRow->get_all_count(query => [ csv_import_report_id => $report_id, row => 0 ]);
135 135

  
136 136
  # manual paginating, yuck
......
141 141
  $pages->{cur}             = $page < 1 ? 1
142 142
                            : $page > $pages->{max} ? $pages->{max}
143 143
                            : $page;
144
  $pages->{common}          = SL::DB::Helper::Paginated::make_common_pages($pages->{cur}, $pages->{max});
144
  $pages->{common}          = [ grep { $_->{visible} } @{ SL::DB::Helper::Paginated::make_common_pages($pages->{cur}, $pages->{max}) } ];
145 145

  
146 146
  $self->{display_rows} = [
147 147
    0,
......
380 380
    profile    => $clone_profile,
381 381
    type       => $self->type,
382 382
    file       => '',
383
    numrows    => scalar @{ $self->data },
383 384
  )->save(cascade => 1);
384 385

  
385 386
  my $dbh = $::form->get_standard_dbh;
SL/DB/MetaSetup/CsvImportReport.pm
15 15
    profile_id => { type => 'integer', not_null => 1 },
16 16
    type       => { type => 'text', not_null => 1 },
17 17
    file       => { type => 'text', not_null => 1 },
18
    numrows    => { type => 'integer' },
18 19
  ],
19 20

  
20 21
  primary_key_columns => [ 'id' ],
sql/Pg-upgrade2/csv_import_report_cache.sql
8 8
  session_id           TEXT NOT NULL,
9 9
  profile_id           INTEGER NOT NULL REFERENCES csv_import_profiles(id),
10 10
  type                 TEXT NOT NULL,
11
  file                 TEXT NOT NULL
11
  file                 TEXT NOT NULL,
12
  numrows              INTEGER NOT NULL,
12 13
);
13 14

  
14 15
CREATE TABLE csv_import_report_rows (
......
28 29
);
29 30

  
30 31
ALTER TABLE csv_import_profiles DROP constraint "csv_import_profiles_name_key";
32

  
33
CREATE INDEX "csv_import_report_rows_index_row" ON csv_import_report_rows (row);

Auch abrufbar als: Unified diff