forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite7a9ccd
committed
I think that NUMERIC datatype has a problem in the performance that
the format on Tuple(Numeric) and the format to calculate(NumericVar)are different. I understood that to reduce I/O. However, when manycomparisons or calculations of NUMERIC are executed, the conversionof Numeric and NumericVar becomes a bottleneck.It is profile result when "create index on NUMERIC column" is executed: % cumulative self self total time seconds seconds calls s/call s/call name 17.61 10.27 10.27 34542006 0.00 0.00 cmp_numerics 11.90 17.21 6.94 34542006 0.00 0.00 comparetup_index 7.42 21.54 4.33 71102587 0.00 0.00 AllocSetAlloc 7.02 25.64 4.09 69084012 0.00 0.00 set_var_from_num 4.87 28.48 2.84 69084012 0.00 0.00 alloc_var 4.79 31.27 2.79 142205745 0.00 0.00 AllocSetFreeIndex 4.55 33.92 2.65 34542004 0.00 0.00 cmp_abs 4.07 36.30 2.38 71101189 0.00 0.00 AllocSetFree 3.83 38.53 2.23 69084012 0.00 0.00 free_varThe create index command executes many comparisons of Numeric values.Functions other than comparetup_index spent a lot of cycles forconversion from Numeric to NumericVar.An attached patch enables the comparison of Numeric values withoutexecuting conversion to NumericVar. The execution time of that SQLbecomes half.o Test SQL (index_test table has 1,000,000 tuples) create index index_test_idx on index_test(num_col);o Test results (executed the test five times)(1)PentiumIII original: 39.789s 36.823s 36.737s 37.752s 37.019s patched : 18.560s 19.103s 18.830s 18.408s 18.853s 4.07 36.30 2.38 71101189 0.00 0.00 AllocSetFree 3.83 38.53 2.23 69084012 0.00 0.00 free_varThe create index command executes many comparisons of Numeric values.Functions other than comparetup_index spent a lot of cycles forconversion from Numeric to NumericVar.An attached patch enables the comparison of Numeric values withoutexecuting conversion to NumericVar. The execution time of that SQLbecomes half.o Test SQL (index_test table has 1,000,000 tuples) create index index_test_idx on index_test(num_col);o Test results (executed the test five times)(1)PentiumIII original: 39.789s 36.823s 36.737s 37.752s 37.019s patched : 18.560s 19.103s 18.830s 18.408s 18.853s(2)Pentium4 original: 16.349s 14.997s 12.979s 13.169s 12.955s patched : 7.005s 6.594s 6.770s 6.740s 6.828s(3)Itanium2 original: 15.392s 15.447s 15.350s 15.370s 15.417s patched : 7.413s 7.330s 7.334s 7.339s 7.339s(4)Ultra Sparc original: 64.435s 59.336s 59.332s 58.455s 59.781s patched : 28.630s 28.666s 28.983s 28.744s 28.595sAtsushi Ogawa1 parent15be0b8 commite7a9ccd
1 file changed
+73
-39
lines changedLines changed: 73 additions & 39 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
17 |
| - | |
| 17 | + | |
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
| |||
229 | 229 |
| |
230 | 230 |
| |
231 | 231 |
| |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
232 | 236 |
| |
233 | 237 |
| |
234 | 238 |
| |
| |||
250 | 254 |
| |
251 | 255 |
| |
252 | 256 |
| |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
253 | 261 |
| |
254 | 262 |
| |
255 | 263 |
| |
| |||
271 | 279 |
| |
272 | 280 |
| |
273 | 281 |
| |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
274 | 286 |
| |
275 | 287 |
| |
276 | 288 |
| |
| |||
1061 | 1073 |
| |
1062 | 1074 |
| |
1063 | 1075 |
| |
1064 |
| - | |
1065 |
| - | |
1066 |
| - | |
1067 |
| - | |
1068 |
| - | |
1069 |
| - | |
1070 |
| - | |
1071 |
| - | |
1072 |
| - | |
1073 |
| - | |
1074 |
| - | |
1075 |
| - | |
1076 |
| - | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
1077 | 1080 |
| |
1078 | 1081 |
| |
1079 | 1082 |
| |
| |||
2591 | 2594 |
| |
2592 | 2595 |
| |
2593 | 2596 |
| |
2594 |
| - | |
| 2597 | + | |
2595 | 2598 |
| |
2596 | 2599 |
| |
2597 | 2600 |
| |
2598 |
| - | |
| 2601 | + | |
2599 | 2602 |
| |
2600 | 2603 |
| |
2601 | 2604 |
| |
| |||
2895 | 2898 |
| |
2896 | 2899 |
| |
2897 | 2900 |
| |
2898 |
| - | |
| 2901 | + | |
2899 | 2902 |
| |
2900 | 2903 |
| |
2901 | 2904 |
| |
| |||
3394 | 3397 |
| |
3395 | 3398 |
| |
3396 | 3399 |
| |
3397 |
| - | |
| 3400 | + | |
| 3401 | + | |
| 3402 | + | |
| 3403 | + | |
| 3404 | + | |
| 3405 | + | |
| 3406 | + | |
| 3407 | + | |
| 3408 | + | |
| 3409 | + | |
| 3410 | + | |
| 3411 | + | |
| 3412 | + | |
| 3413 | + | |
| 3414 | + | |
| 3415 | + | |
| 3416 | + | |
| 3417 | + | |
| 3418 | + | |
3398 | 3419 |
| |
3399 |
| - | |
| 3420 | + | |
3400 | 3421 |
| |
3401 |
| - | |
| 3422 | + | |
3402 | 3423 |
| |
3403 | 3424 |
| |
3404 | 3425 |
| |
3405 |
| - | |
| 3426 | + | |
3406 | 3427 |
| |
3407 |
| - | |
| 3428 | + | |
3408 | 3429 |
| |
3409 | 3430 |
| |
3410 | 3431 |
| |
3411 | 3432 |
| |
3412 |
| - | |
| 3433 | + | |
3413 | 3434 |
| |
3414 |
| - | |
| 3435 | + | |
3415 | 3436 |
| |
3416 |
| - | |
| 3437 | + | |
| 3438 | + | |
3417 | 3439 |
| |
3418 | 3440 |
| |
3419 |
| - | |
| 3441 | + | |
3420 | 3442 |
| |
3421 | 3443 |
| |
3422 |
| - | |
| 3444 | + | |
| 3445 | + | |
3423 | 3446 |
| |
3424 | 3447 |
| |
3425 | 3448 |
| |
| |||
4814 | 4837 |
| |
4815 | 4838 |
| |
4816 | 4839 |
| |
4817 |
| - | |
4818 |
| - | |
| 4840 | + | |
| 4841 | + | |
| 4842 | + | |
| 4843 | + | |
| 4844 | + | |
| 4845 | + | |
| 4846 | + | |
| 4847 | + | |
| 4848 | + | |
| 4849 | + | |
| 4850 | + | |
| 4851 | + | |
| 4852 | + | |
| 4853 | + | |
| 4854 | + | |
4819 | 4855 |
| |
4820 | 4856 |
| |
4821 |
| - | |
4822 |
| - | |
4823 | 4857 |
| |
4824 | 4858 |
| |
4825 | 4859 |
| |
4826 |
| - | |
| 4860 | + | |
4827 | 4861 |
| |
4828 | 4862 |
| |
4829 | 4863 |
| |
4830 |
| - | |
| 4864 | + | |
4831 | 4865 |
| |
4832 |
| - | |
| 4866 | + | |
4833 | 4867 |
| |
4834 | 4868 |
| |
4835 | 4869 |
| |
4836 |
| - | |
| 4870 | + | |
4837 | 4871 |
| |
4838 | 4872 |
| |
4839 | 4873 |
| |
4840 | 4874 |
| |
4841 |
| - | |
| 4875 | + | |
4842 | 4876 |
| |
4843 |
| - | |
| 4877 | + | |
4844 | 4878 |
| |
4845 | 4879 |
| |
4846 | 4880 |
| |
| |||
4857 | 4891 |
| |
4858 | 4892 |
| |
4859 | 4893 |
| |
4860 |
| - | |
| 4894 | + | |
4861 | 4895 |
| |
4862 | 4896 |
| |
4863 | 4897 |
| |
4864 | 4898 |
| |
4865 |
| - | |
| 4899 | + | |
4866 | 4900 |
| |
4867 | 4901 |
| |
4868 | 4902 |
| |
|
0 commit comments
Comments
(0)