Created
February 4, 2019 16:00
-
-
Save tbg/3507e476397ee97a0585207ac2a68a1c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@:26257/tpcc> SELECT *, w_ytd-sum_d_ytd FROM warehouse FULL OUTER JOIN (SELECT d_w_id, sum(d_ytd) as sum_d_ytd FROM district GROUP BY d_w_id) ON (w_id = d_w_id) WHERE w_ytd != sum_d_ytd; | |
w_id | w_name | w_street_1 | w_street_2 | w_city | w_state | w_zip | w_tax | w_ytd | d_w_id | sum_d_ytd | ?column? | |
+------+--------+------------+------------+--------+---------+-----------+--------+-----------+--------+-----------+----------+ | |
564 | 6 | 12 | 17 | 13 | PE | 508411111 | 0.1030 | 339127.73 | 564 | 344001.97 | -4874.24 | |
(1 row) | |
root@:26257/tpcc> select * from history where h_amount = 4874.24; | |
rowid | h_c_id | h_c_d_id | h_c_w_id | h_d_id | h_w_id | h_date | h_amount | h_data | |
+--------------------------------------+--------+----------+----------+--------+--------+---------------------------+----------+---------------+ | |
fd3f4548-1fd2-490d-b577-837dd21bc1af | 626 | 10 | 564 | 10 | 564 | 2019-02-04 08:38:33+00:00 | 4874.24 | 6 EEAGqcs4 | |
(1 row) | |
root@:26257/tpcc> select * from history where h_w_id = 564 and h_date >= '2019-02-04 08:38:33+00:00' order by h_date asc; | |
rowid | h_c_id | h_c_d_id | h_c_w_id | h_d_id | h_w_id | h_date | h_amount | h_data | |
+--------------------------------------+--------+----------+----------+--------+--------+---------------------------+----------+-----------------+ | |
fd3f4548-1fd2-490d-b577-837dd21bc1af | 626 | 10 | 564 | 10 | 564 | 2019-02-04 08:38:33+00:00 | 4874.24 | 6 EEAGqcs4 | |
bd222e0c-1d13-4d55-a6cb-537963760980 | 625 | 9 | 564 | 9 | 564 | 2019-02-04 08:38:44+00:00 | 3305.78 | 6 VOFtFInk | |
c6804dd5-75da-460b-af97-bbec5d0de2af | 2087 | 4 | 564 | 4 | 564 | 2019-02-04 08:39:48+00:00 | 3288.97 | 6 BhXwEZTfi | |
f203d61a-a71e-4169-93f0-1a91b8d786bc | 1777 | 2 | 564 | 2 | 564 | 2019-02-04 08:40:36+00:00 | 4818.66 | 6 WhHGiO | |
df9e5e0d-a29f-424c-b323-5cd0f1de6774 | 891 | 3 | 564 | 3 | 564 | 2019-02-04 08:42:01+00:00 | 151.82 | 6 a9rqGLdBHU | |
dba1df06-a38d-4707-b75d-3a7df8f87f2a | 303 | 9 | 980 | 1 | 564 | 2019-02-04 08:42:23+00:00 | 292.36 | 6 6p1U7G | |
47061697-0b0f-44d5-860c-12d863cb8ebb | 120 | 3 | 564 | 3 | 564 | 2019-02-04 08:43:04+00:00 | 1264.61 | 6 a9rqGLdBHU | |
f526df33-0ee4-4f64-953c-ac2d55ea18c8 | 2280 | 6 | 564 | 6 | 564 | 2019-02-04 08:44:02+00:00 | 1931.68 | 6 l2tF0sRu | |
ff085de5-41f9-42f6-8a94-14c95990ebd1 | 616 | 9 | 564 | 9 | 564 | 2019-02-04 08:44:53+00:00 | 4299.64 | 6 VOFtFInk | |
aa6695b1-d28f-4e2d-b201-44763498e305 | 859 | 8 | 564 | 8 | 564 | 2019-02-04 08:48:17+00:00 | 2217.30 | 6 GJSzug | |
e8e0ef4a-cf31-4084-92b4-e1d751a635bb | 307 | 8 | 564 | 8 | 564 | 2019-02-04 08:49:23+00:00 | 3588.13 | 6 GJSzug | |
4b6c52f4-5cdd-4bf0-8797-d6538ae21cf4 | 1833 | 4 | 564 | 4 | 564 | 2019-02-04 08:58:12+00:00 | 3689.00 | 6 BhXwEZTfi | |
(12 rows) | |
Finding the delta system time: | |
root@:26257/tpcc> select sum(h_amount) from history as of system time '2019-02-04 08:40:40+00:00' where h_w_id = 564; | |
sum | |
+-----------+ | |
320858.83 | |
(1 row) | |
root@:26257/tpcc> select w_ytd from warehouse as of system time '2019-02-04 08:40:40+00:00' where w_id = 564 ; | |
w_ytd | |
+-----------+ | |
315984.59 | |
(1 row) | |
oot@:26257/tpcc> select 320858.83 - 315984.59; | |
?column? | |
+----------+ | |
4874.24 | |
(1 row) | |
The inconsistency actually shows up earlier. It's within 100ms of 08:40:38.600. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment