Moises Lopez - https://www.vauxoo.com/
088b9c2398
[REF] account_check_printing: Speed-up payment creation
...
The method constraint to validate the Check Number is slow
1. Analyzing the following query:
```sql
SELECT
payment.check_number,
move.journal_id
FROM
account_payment payment
JOIN account_move move ON move.id = payment.move_id
JOIN account_journal journal ON journal.id = move.journal_id,
account_payment other_payment
JOIN account_move other_move ON other_move.id = other_payment.move_id
WHERE
payment.check_number::integer = other_payment.check_number::integer
AND move.journal_id = other_move.journal_id
AND payment.id != other_payment.id
AND payment.id IN (1085159)
AND move.state = 'posted'
AND other_move.state = 'posted';
```
The output is:
Planning Time: 3.354 ms
Execution Time: 2514.660 ms
Discarding null values
```diff
AND other_move.state = 'posted';
+ AND payment.check_number IS NOT NULL
+ AND other_payment.check_number IS NOT NULL
```
The output is
Planning Time: 3.216 ms
Execution Time: 0.140 ms
2. The constraint is computed even if the payment is not a check (check_number is empty)
Returning early save useless extra computating
It is not needed to compare falsy values for duplicated for whole table
3. The validation to check is it not a number is not optimal
It is transforming the string -> integer -> string to check if the string is not a number
but it is enough using only string -> integer not needed to transform to string again
python3 -m timeit -u msec -s "check_numbers = [str(i) for i in range(1000000)]" "[str(int(i)) for i in check_numbers]"
> 1 loop, best of 5: 323 msec per loop
python3 -m timeit -u msec -s "check_numbers = [str(i) for i in range(1000000)]" "[int(i) for i in check_numbers]"
> 2 loops, best of 5: 135 msec per loop
It is better but not enough, using `str.isdigit` method is 5x faster than original approach
python3 -m timeit -u msec -s "check_numbers = [str(i) for i in range(1000000)]" "[i.isdecimal() for i in check_numbers]"
> 5 loops, best of 5: 64 msec per loop
closes odoo/odoo#83851
X-original-commit: 31e0ed8c957e8a6af7f6bd5d449b450967206eab
Signed-off-by: Olivier Colson <oco@odoo.com >
2022-02-03 09:03:13 +00:00
..
2022-02-02 09:03:44 +00:00
2022-02-03 09:03:13 +00:00
2021-11-10 06:49:58 +00:00
2022-01-05 11:36:06 +00:00
2022-01-31 10:07:34 +00:00
2022-02-01 09:54:08 +00:00
2022-01-10 19:28:36 +00:00
2021-12-08 16:28:53 +00:00
2022-01-28 14:10:01 +00:00
2021-07-26 13:09:57 +00:00
2021-07-26 13:09:57 +00:00
2021-11-08 09:25:47 +00:00
2021-11-23 11:12:14 +00:00
2021-09-02 14:15:12 +00:00
2021-07-26 13:09:57 +00:00
2022-01-28 14:10:01 +00:00
2021-09-16 07:17:40 +00:00
2021-09-16 07:17:40 +00:00
2021-07-26 13:09:57 +00:00
2022-02-01 09:54:08 +00:00
2021-11-26 09:44:58 +00:00
2021-07-26 13:09:57 +00:00
2021-07-26 13:09:57 +00:00
2022-01-31 17:47:34 +00:00
2022-02-01 17:15:30 +00:00
2021-11-22 14:48:04 +00:00
2022-02-01 17:15:30 +00:00
2021-09-16 07:17:40 +00:00
2022-01-31 12:06:05 +00:00
2022-01-31 12:06:04 +00:00
2022-01-25 17:21:04 +00:00
2022-01-20 11:03:01 +00:00
2021-12-07 13:48:53 +00:00
2021-07-26 13:09:57 +00:00
2022-01-22 14:13:41 +00:00
2021-12-14 12:39:54 +00:00
2021-10-28 09:17:34 +00:00
2021-07-26 13:09:57 +00:00
2021-12-07 13:48:53 +00:00
2021-12-13 12:24:50 +00:00
2022-01-20 11:03:01 +00:00
2022-02-02 09:03:44 +00:00
2021-12-16 09:00:19 +00:00
2021-09-16 07:17:40 +00:00
2022-01-28 18:58:44 +00:00
2022-02-02 18:14:54 +00:00
2022-01-21 15:03:57 +00:00
2022-01-28 14:10:01 +00:00
2021-12-15 00:10:51 +00:00
2021-12-14 12:39:54 +00:00
2021-09-16 07:17:40 +00:00
2022-02-01 09:54:08 +00:00
2021-12-02 12:12:01 +01:00
2022-02-02 11:46:52 +00:00
2021-12-08 09:35:03 +00:00
2022-01-28 14:10:01 +00:00
2021-12-16 17:33:47 +00:00
2022-02-01 15:32:26 +00:00
2021-12-24 14:57:02 +00:00
2021-07-26 13:09:57 +00:00
2022-01-19 16:52:23 +00:00
2021-12-16 17:33:47 +00:00
2022-02-01 15:32:16 +00:00
2022-02-01 15:32:16 +00:00
2022-01-13 09:30:56 +00:00
2022-01-19 16:52:23 +00:00
2021-07-26 13:09:57 +00:00
2021-10-11 10:15:49 +00:00
2022-01-27 09:12:50 +00:00
2022-02-02 18:14:54 +00:00
2021-09-23 07:17:43 +00:00
2022-02-01 15:32:16 +00:00
2021-11-22 14:48:04 +00:00
2022-01-12 08:33:00 +00:00
2022-02-03 08:09:31 +00:00
2022-01-31 08:14:50 +00:00
2022-01-27 16:17:17 +00:00
2022-01-11 16:18:49 +00:00
2022-01-20 16:08:22 +00:00
2021-07-26 13:09:57 +00:00
2022-02-02 18:14:54 +00:00
2021-12-07 13:48:53 +00:00
2021-12-14 19:13:18 +00:00
2021-12-09 16:14:43 +00:00
2021-12-07 13:48:53 +00:00
2022-01-31 17:47:30 +00:00
2021-12-25 02:26:44 +00:00
2021-12-20 07:55:41 +00:00
2021-12-15 12:07:26 +00:00
2021-07-26 13:09:57 +00:00
2022-01-31 19:25:47 +00:00
2021-09-16 07:17:40 +00:00
2022-01-03 18:11:19 +00:00
2022-01-26 15:59:03 +00:00
2022-02-02 18:14:54 +00:00
2022-02-03 08:09:31 +00:00
2021-12-14 12:39:54 +00:00
2021-07-26 13:09:57 +00:00
2021-10-07 17:59:52 +00:00
2022-02-01 09:54:08 +00:00
2021-10-19 15:58:58 +00:00
2022-01-21 15:03:57 +00:00
2022-01-28 16:09:26 +00:00
2021-07-26 13:09:57 +00:00
2021-11-25 00:31:17 +00:00
2021-12-08 11:17:22 +00:00
2022-01-31 15:33:41 +00:00
2021-07-26 13:09:57 +00:00
2021-11-25 00:31:17 +00:00
2022-01-27 16:17:10 +00:00
2022-01-13 14:35:57 +00:00
2022-01-18 08:18:06 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-10-01 12:40:54 +00:00
2022-01-31 10:07:21 +00:00
2022-01-28 14:10:01 +00:00
2021-07-26 13:09:57 +00:00
2022-01-25 17:21:04 +00:00
2022-01-25 17:21:04 +00:00
2022-01-27 21:50:25 +00:00
2021-10-01 12:40:54 +00:00
2021-12-15 22:31:20 +00:00
2021-11-25 00:31:17 +00:00
2021-10-01 12:40:54 +00:00
2021-10-01 12:40:54 +00:00
2021-12-18 21:00:49 +00:00
2021-10-28 08:33:17 +00:00
2021-10-28 08:33:17 +00:00
2021-10-28 08:33:17 +00:00
2021-10-28 08:33:17 +00:00
2022-01-26 11:46:15 +00:00
2021-11-25 00:31:17 +00:00
2021-07-26 13:09:57 +00:00
2022-01-18 16:17:43 +00:00
2022-01-31 13:57:55 +00:00
2022-02-01 09:54:08 +00:00
2021-11-25 00:31:17 +00:00
2021-09-27 16:56:27 +00:00
2021-11-25 00:31:17 +00:00
2022-01-31 13:58:03 +00:00
2022-02-01 09:54:21 +00:00
2022-01-27 21:50:25 +00:00
2021-12-17 21:59:10 +00:00
2022-01-11 13:34:56 +00:00
2021-07-26 13:09:57 +00:00
2021-11-25 00:31:17 +00:00
2021-10-01 12:40:54 +00:00
2021-07-26 13:09:57 +00:00
2021-10-01 12:40:54 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-07-26 13:09:57 +00:00
2021-07-26 13:09:57 +00:00
2021-09-16 07:17:40 +00:00
2021-11-25 00:31:17 +00:00
2022-01-18 11:02:02 +00:00
2022-01-27 21:50:25 +00:00
2021-08-03 17:58:58 +00:00
2021-07-26 13:09:57 +00:00
2021-12-14 14:47:25 +00:00
2021-07-26 13:09:57 +00:00
2021-07-26 13:09:57 +00:00
2021-11-25 00:31:17 +00:00
2022-01-31 10:07:26 +00:00
2022-01-20 22:05:06 +00:00
2022-01-14 14:49:57 +00:00
2021-11-25 00:31:17 +00:00
2022-01-28 14:10:01 +00:00
2022-01-28 14:10:01 +00:00
2022-01-25 19:06:59 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-10-01 12:40:54 +00:00
2022-01-12 10:17:47 +00:00
2022-01-25 19:07:03 +00:00
2022-01-25 17:21:04 +00:00
2021-12-14 10:00:41 +00:00
2021-11-25 00:31:17 +00:00
2021-11-22 14:48:04 +00:00
2021-11-25 00:31:17 +00:00
2021-10-01 12:40:54 +00:00
2022-01-25 17:21:04 +00:00
2021-12-22 00:12:52 +00:00
2021-11-25 00:31:17 +00:00
2022-01-25 15:41:17 +00:00
2021-12-15 22:31:20 +00:00
2021-11-25 00:31:17 +00:00
2022-01-05 23:05:43 +00:00
2022-01-27 21:50:25 +00:00
2022-01-21 11:25:59 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-12-15 22:31:20 +00:00
2021-10-01 12:40:54 +00:00
2021-11-25 00:31:17 +00:00
2022-01-25 18:14:59 +00:00
2021-07-26 13:09:57 +00:00
2021-11-25 00:31:17 +00:00
2021-07-26 13:09:57 +00:00
2021-11-25 00:31:17 +00:00
2021-10-01 12:40:54 +00:00
2021-11-25 00:31:17 +00:00
2021-11-25 00:31:17 +00:00
2021-12-14 09:11:15 +00:00
2022-01-11 16:18:54 +00:00
2022-02-03 08:09:31 +00:00
2021-12-15 00:10:51 +00:00
2021-12-21 09:49:38 +00:00
2022-01-31 17:47:30 +00:00
2021-12-14 19:13:18 +00:00
2022-02-02 09:03:44 +00:00
2022-02-01 13:38:49 +00:00
2021-12-07 13:48:53 +00:00
2021-09-07 18:08:03 +00:00
2021-07-26 13:09:57 +00:00
2021-07-26 13:09:57 +00:00
2021-10-14 09:28:09 +00:00
2021-07-26 13:09:57 +00:00
2022-01-06 11:45:23 +00:00
2021-09-16 07:17:40 +00:00
2021-10-22 11:09:16 +00:00
2022-01-28 14:10:01 +00:00
2021-10-11 10:15:49 +00:00
2021-07-26 13:09:57 +00:00
2022-01-17 08:38:45 +00:00
2022-02-01 18:06:50 +00:00
2022-01-19 16:03:53 +00:00
2021-07-26 13:09:57 +00:00
2021-12-07 16:20:05 +00:00
2022-01-11 15:24:11 +00:00
2022-02-01 18:06:50 +00:00
2021-12-07 16:20:05 +00:00
2021-12-07 16:20:06 +00:00
2021-12-07 16:20:06 +00:00
2022-02-02 09:03:44 +00:00
2022-02-01 09:54:08 +00:00
2022-02-02 19:50:49 +00:00
2022-02-02 19:50:49 +00:00
2022-02-02 19:50:49 +00:00
2022-02-02 19:50:49 +00:00
2022-02-02 19:50:49 +00:00
2022-02-02 19:50:49 +00:00
2022-02-02 19:50:49 +00:00
2022-02-02 19:50:49 +00:00
2022-02-02 19:50:49 +00:00
2022-02-02 19:50:49 +00:00
2022-02-02 19:50:49 +00:00
2022-02-02 19:50:49 +00:00
2022-02-02 19:50:49 +00:00
2022-02-02 19:50:49 +00:00
2021-09-16 07:17:40 +00:00
2022-02-01 18:07:11 +00:00
2022-01-31 17:47:34 +00:00
2021-11-22 14:48:04 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-31 13:58:10 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-01-27 21:50:25 +00:00
2022-02-02 09:03:52 +00:00
2021-09-07 15:50:00 +00:00
2022-01-31 12:06:05 +00:00
2021-09-16 07:17:40 +00:00
2022-01-19 16:52:23 +00:00
2021-09-16 07:17:40 +00:00
2022-02-03 08:09:31 +00:00
2022-01-04 17:03:10 +00:00
2021-12-14 12:39:54 +00:00
2022-01-04 17:03:10 +00:00
2022-01-04 17:03:10 +00:00
2021-12-14 19:13:18 +00:00
2022-02-02 09:03:44 +00:00
2022-01-10 14:49:52 +00:00
2021-11-24 16:33:01 +00:00
2022-02-02 09:03:44 +00:00
2021-10-27 15:48:51 +00:00
2021-09-16 07:17:40 +00:00
2022-02-02 16:40:48 +00:00
2022-01-05 13:58:01 +01:00
2022-01-28 14:10:01 +00:00
2022-02-01 14:37:37 +00:00
2022-02-01 13:38:49 +00:00
2021-12-23 15:30:23 +01:00
2021-07-26 13:09:57 +00:00
2021-12-14 14:47:25 +00:00
2021-12-02 12:12:01 +01:00
2021-12-02 12:12:03 +01:00
2022-01-17 12:17:24 +00:00
2021-12-02 12:12:03 +01:00
2022-01-20 12:30:05 +00:00
2021-12-23 15:30:23 +01:00
2021-12-02 12:12:03 +01:00
2022-01-31 19:25:47 +00:00
2021-11-23 11:12:14 +00:00
2022-01-28 14:10:01 +00:00
2021-10-15 14:58:53 +00:00
2022-01-14 17:29:35 +00:00
2021-07-26 13:09:57 +00:00
2022-02-02 18:14:54 +00:00
2021-11-08 07:59:42 +00:00
2022-02-02 21:49:05 +00:00
2021-11-29 14:55:35 +00:00
2022-02-01 14:37:54 +00:00
2022-02-01 18:07:02 +00:00
2022-02-02 19:50:45 +00:00
2021-10-29 16:05:23 +00:00
2021-07-26 13:09:57 +00:00
2022-02-03 08:09:31 +00:00
2022-01-28 14:10:01 +00:00
2021-12-07 16:20:06 +00:00
2021-12-14 19:13:18 +00:00
2022-02-02 11:46:53 +00:00
2021-10-05 16:54:21 +00:00
2022-02-02 09:03:44 +00:00
2022-01-19 16:52:23 +00:00
2022-02-02 18:14:54 +00:00
2022-02-02 18:14:54 +00:00
2022-02-02 18:14:54 +00:00
2022-02-02 18:14:54 +00:00
2022-02-02 18:14:54 +00:00
2022-01-20 15:11:50 +00:00
2022-01-17 16:56:01 +00:00
2021-09-30 17:12:12 +00:00
2021-11-30 15:21:47 +00:00
2022-01-17 06:42:47 +00:00
2021-09-30 17:12:12 +00:00
2021-09-16 07:17:40 +00:00
2022-01-31 12:06:04 +00:00
2022-01-20 10:06:47 +00:00
2022-02-03 08:09:31 +00:00
2022-02-03 08:09:31 +00:00
2021-09-16 07:17:40 +00:00
2022-01-31 23:51:00 +00:00
2022-01-22 11:51:42 +00:00
2022-02-03 08:09:31 +00:00
2022-01-31 23:51:00 +00:00
2021-12-07 13:48:53 +00:00
2022-02-01 09:54:08 +00:00
2021-07-26 13:09:57 +00:00
2022-01-31 17:47:32 +00:00
2021-07-26 13:09:57 +00:00
2021-10-15 14:58:53 +00:00
2022-01-28 14:10:01 +00:00
2021-12-07 13:48:53 +00:00
2021-10-04 15:30:26 +00:00
2021-12-07 13:48:53 +00:00
2021-09-16 07:17:40 +00:00
2021-07-26 13:09:57 +00:00
2021-07-26 13:09:57 +00:00
2022-01-10 13:52:27 +00:00
2022-01-10 13:52:27 +00:00
2021-09-16 07:17:40 +00:00
2021-12-16 17:33:48 +00:00
2022-01-04 08:47:00 +00:00
2022-01-22 11:51:42 +00:00
2021-12-07 13:48:53 +00:00
2021-07-26 13:09:57 +00:00
2021-09-16 07:17:40 +00:00
2021-09-18 05:42:55 +00:00
2022-02-02 18:14:54 +00:00
2021-07-26 13:09:57 +00:00
2021-10-04 07:57:00 +00:00
2021-07-26 13:09:57 +00:00
2021-10-04 14:12:26 +00:00
2022-01-28 16:09:26 +00:00
2021-07-26 13:09:57 +00:00
2021-07-12 10:57:37 +00:00
2021-09-16 07:17:40 +00:00
2021-12-20 19:16:55 +00:00
2021-07-26 13:09:57 +00:00
2021-10-15 14:58:53 +00:00
2021-12-17 12:51:49 +00:00
2022-01-22 11:51:42 +00:00
2022-02-02 18:14:54 +00:00
2021-12-07 13:48:53 +00:00
2021-08-20 06:22:21 +00:00
2021-11-25 13:28:51 +00:00
2021-07-26 13:09:57 +00:00
2021-12-17 12:51:49 +00:00
2021-12-02 12:12:01 +01:00
2022-01-28 11:27:42 +00:00
2021-09-07 15:50:01 +00:00
2021-09-03 15:45:08 +00:00
2021-12-07 13:48:53 +00:00
2022-02-02 09:03:44 +00:00
2021-08-09 14:13:58 +00:00
2021-12-23 15:30:23 +01:00
2021-12-07 13:48:53 +00:00
2022-02-02 09:03:44 +00:00
2021-12-07 13:48:53 +00:00
2021-12-14 19:13:18 +00:00
2021-07-26 13:09:57 +00:00
2021-12-14 19:13:18 +00:00