Apply review comments.

This commit is contained in:
Dimitri Fontaine 2020-04-03 23:17:42 +02:00
parent 2ab5da3159
commit 285c1fcbba
4 changed files with 14 additions and 18 deletions

View File

@ -261,22 +261,17 @@
(view-list (copy-list (view-list catalog))))
;; when materialized views are not supported, view-list is empty here
(cond
((notevery #'null (mapcar #'table-row-count-estimate table-list))
(flet ((compare-row-count-estimates (a b)
(declare (type (or null fixnum) a b))
(> (or a 0) (or b 0))))
(let ((sorted-table-list (sort table-list
#'compare-row-count-estimates
:key #'table-row-count-estimate)))
(log-message :notice
"Processing tables in this order: ~{~a: ~d rows~^, ~}"
(loop :for table
:in (append sorted-table-list view-list)
:append (list (format-table-name table)
(table-row-count-estimate table))))
(append sorted-table-list view-list))))
((notevery #'zerop (mapcar #'table-row-count-estimate table-list))
(let ((sorted-table-list
(sort table-list #'> :key #'table-row-count-estimate)))
(log-message :notice
"Processing tables in this order: ~{~a: ~d rows~^, ~}"
(loop :for table :in (append table-list view-list)
:collect (format-table-name table)
:collect (table-row-count-estimate table)))
(nconc sorted-table-list view-list)))
(t
(append table-list view-list)))))
(nconc table-list view-list)))))
;;;

View File

@ -154,7 +154,7 @@
(:documentation "Get the list of foreign keys from the source database."))
(defgeneric fetch-table-row-count (catalog db-copy &key including excluding)
(:documentation "Get the estimate row count for tables in the source database"))
(:documentation "Retrieve and set the row count estimate for given tables."))
(defgeneric fetch-comments (catalog db-copy &key including excluding)
(:documentation "Get the list of comments from the source database."))

View File

@ -163,7 +163,7 @@
&key
including
excluding)
"Get the row count estimate for given MySQL tables."
"Retrieve and set the row count estimate for given MySQL tables."
(loop
:for (table-name count)
:in (mysql-query (sql "/mysql/list-table-rows.sql"

View File

@ -48,7 +48,8 @@
table-list view-list matview-list extension-list sqltype-list)
(defstruct table source-name name schema oid comment
storage-parameter-list tablespace row-count-estimate
storage-parameter-list tablespace
(row-count-estimate 0 :type fixnum)
;; field is for SOURCE
field-list
;; column is for TARGET