From 42639fb2e42b4f1f13af20aaf09b941043a756bb Mon Sep 17 00:00:00 2001 From: Ihar Hancharenka Date: Wed, 8 Jan 2025 13:39:32 +0300 Subject: [PATCH] m --- .../postgres/feature/functions/gen-data.txt | 2 +- .../{layers.txt => storage/storage.txt} | 3 + .../feature/internals/vacuum/vacuum-cfg.txt | 1 + .../feature/performance/docs/courses.txt | 6 +- .../performance/explain/presentations.txt | 22 +++++++- .../performance/index/presentations.txt | 56 ++++++++++++++++++- .../performance/planner/statistics.txt | 3 + pl/java/libfws/mapping/mapstruct.txt | 50 ----------------- pl/java/libfws/mapping/mapstruct/articles.txt | 21 +++++++ .../mapstruct/features/enum-mapping.txt | 6 ++ .../libfws/mapping/mapstruct/mapstruct.txt | 24 ++++++++ pl/java/libfws/mapping/mapstruct/src.txt | 2 + science/ai/free/deepsek.txt | 2 + 13 files changed, 141 insertions(+), 57 deletions(-) rename db/sql/postgres/feature/internals/{layers.txt => storage/storage.txt} (84%) create mode 100644 db/sql/postgres/feature/internals/vacuum/vacuum-cfg.txt delete mode 100644 pl/java/libfws/mapping/mapstruct.txt create mode 100644 pl/java/libfws/mapping/mapstruct/articles.txt create mode 100644 pl/java/libfws/mapping/mapstruct/features/enum-mapping.txt create mode 100644 pl/java/libfws/mapping/mapstruct/mapstruct.txt create mode 100644 pl/java/libfws/mapping/mapstruct/src.txt diff --git a/db/sql/postgres/feature/functions/gen-data.txt b/db/sql/postgres/feature/functions/gen-data.txt index e1281993e..491825d84 100644 --- a/db/sql/postgres/feature/functions/gen-data.txt +++ b/db/sql/postgres/feature/functions/gen-data.txt @@ -1,3 +1,3 @@ https://www.postgresql.org/docs/current/functions-srf.html https://postgrespro.ru/docs/postgrespro/17/functions-srf -... from generate_series(1, 10000) as id; +... from generate_series(1, 1e6) as id; diff --git a/db/sql/postgres/feature/internals/layers.txt b/db/sql/postgres/feature/internals/storage/storage.txt similarity index 84% rename from db/sql/postgres/feature/internals/layers.txt rename to db/sql/postgres/feature/internals/storage/storage.txt index 547683d4a..f2bd49fdc 100644 --- a/db/sql/postgres/feature/internals/layers.txt +++ b/db/sql/postgres/feature/internals/storage/storage.txt @@ -1,3 +1,6 @@ +https://www.postgresql.org/docs/current/storage.html +https://www.postgresql.org/docs/current/storage-page-layout.html + each table consists from multiple layers each file is no more than 1 Gb diff --git a/db/sql/postgres/feature/internals/vacuum/vacuum-cfg.txt b/db/sql/postgres/feature/internals/vacuum/vacuum-cfg.txt new file mode 100644 index 000000000..face58b9d --- /dev/null +++ b/db/sql/postgres/feature/internals/vacuum/vacuum-cfg.txt @@ -0,0 +1 @@ +https://www.postgresql.org/docs/current/runtime-config-autovacuum.html diff --git a/db/sql/postgres/feature/performance/docs/courses.txt b/db/sql/postgres/feature/performance/docs/courses.txt index 7e95f55fd..af64c606c 100644 --- a/db/sql/postgres/feature/performance/docs/courses.txt +++ b/db/sql/postgres/feature/performance/docs/courses.txt @@ -1,10 +1,10 @@ 2023 +Tenzor - Borovikov - Backend School for PG + https://www.youtube.com/playlist?list=PLt0vzWoDuwcTdFnp-QWtx2yEvKMDlPw7l + https://github.com/Kilor/PG-for-beginners PostgresProfessional - RogovLuzanovTolmachyov - QPT13 - Query Optimization of p12 https://postgrespro.ru/education/courses/QPT https://www.youtube.com/playlist?list=PLaFqU3KCWw6JW80WBHPOe-SMJD2NOjmge 2019 PostgresProfessional - RogovLuzanovTolmachyov - QPT10 https://www.youtube.com/playlist?list=PLaFqU3KCWw6K2sTAksX5AJq4SQDN5PA1t -???? -Tenzor - Borovikov - https://github.com/Kilor/PG-for-beginners diff --git a/db/sql/postgres/feature/performance/explain/presentations.txt b/db/sql/postgres/feature/performance/explain/presentations.txt index da08b3598..4f1e33cdd 100644 --- a/db/sql/postgres/feature/performance/explain/presentations.txt +++ b/db/sql/postgres/feature/performance/explain/presentations.txt @@ -1,5 +1,25 @@ 2023 Tenzor - Backend School p4 - Query Analysis p2 0:00 of 1:40:59 https://www.youtube.com/watch?v=Rg7AAEso3z0 -Tenzor - Backend School p4 - Query Analysis p1 0:00 of 1:24:11 +Tenzor - Backend School p4 - Query Analysis p1 9:00 of 1:24:11 https://www.youtube.com/watch?v=4g2CJv0jRk0 + ! 3:00 - by default PG does not get hints regarding plans + ! 18:00 - explain(settings) select * from pg_class; -- to check current settings + ! https://www.postgresql.org/docs/current/runtime-config.html + ! 27:48 - if counts of planned and actual record does not near the same, most probably statistics is obsolete + ! https://www.postgresql.org/docs/current/planner-stats.html + ! https://www.postgresql.org/docs/current/runtime-config-autovacuum.html + ! 30:32 !!! not enough statistics + ! alter table ... alter column ... set statistics [0..10000] -- columns of hystogram (max 10000 per column) + ! https://www.postgresql.org/docs/current/sql-createstatistics.html + ! 39:00 - shared_buffers setting need to be increased if multiple clients get mostly the same data + ! 43:00 - set io_track_timings=on; explain analyze ... + ! 52:00 - ! rows removed by filter should be small + ! 58.00 - https://www.postgresql.org/docs/current/storage.html + ! 59.00 - https://www.postgresql.org/docs/current/storage-page-layout.html + ! TID Scan - the dumbiest one + ! Seq Scan - linear, dumb one + ! Index Scan - smart + ! Index Only Scan - smartest + ! 1:09:00 - if Heap Fetches quite large, we made worse by this idx, compare to just "Index Scan" + ! 1:13:00 - Foreign Scan - for tables on ext servers diff --git a/db/sql/postgres/feature/performance/index/presentations.txt b/db/sql/postgres/feature/performance/index/presentations.txt index 4d54e4b83..d034139a7 100644 --- a/db/sql/postgres/feature/performance/index/presentations.txt +++ b/db/sql/postgres/feature/performance/index/presentations.txt @@ -21,10 +21,62 @@ JPoint - Sitnikov - B-Tree indices using Boot, PostgreSQL, JPA 18:00 of 45:07 ! select ... from users where state = 'PENDING' and name = ? ! create index state_name_users on users(name) include(state) -- idx will not sort by state, just include it ! create index of (col1, col2) -- index sorted on combination of state, name -Tenzor - Backend School - PG Indices p2 0:00 of 1:21:33 +Tenzor - Backend School - PG Indices p2 2:00 of 1:21:33 https://www.youtube.com/watch?v=WTELBpLUb2E -Tenzor - Backend School - PG Indices p1 0:00 of 1:10:44 + ! 4:00 - hash idx - https://www.postgresql.org/docs/current/hash-index.html + ! 6:00 - !! hash idx can be created only on one field (with = operator), we can use op with single eq-op + ! 7:00 - create index ... using hash(fild-name); + ! 10:00 - gist - generalized search tree -- https://www.postgresql.org/docs/current/gist.html + ! universal infrastructure (b-tree, r-tree, rd-tree) + ! 12:00 - gist support geom-operators (<<, &<, &>, >>, <@, ~=, &&, <<|, &<|, ~, @), point, box, circle, poly types + ! https://www.postgresql.org/docs/current/functions-geometry.html + ! 18:00 https://www.postgresql.org/docs/current/functions-net.html, inet-type + ! 25:00 - gist is good for ranges ... using gist(daterange(dtb, dte, '[]')); + ! ... where daterange(dtb, dte, '[]') @> '2023-01-01'::date; -- 8-times less hits than b-tree + ! 29:00 - gist-operators with btree behavior + ! https://www.postgresql.org/docs/current/btree-gist.html + ! 31:00 - pg-antipatterns for gist - https://habr.com/ru/companies/tensor/articles/679834/ + ! 40:00 - https://www.postgresql.org/docs/16/gist-examples.html (? no from v17) + ! 51:00 - create index ...with (buffering=auto); -- https://www.postgresql.org/docs/16/gist-implementation.html (? no for 17) + ! 52:00 - spgist (gist optimized for space partitioning) -- https://www.postgresql.org/docs/current/spgist.html + ! only for the single field + ! 54:00 - gin (generalized inverted index) -- https://www.postgresql.org/docs/current/gin.html + ! https://www.postgresql.org/docs/16/gin-examples.html (? no from v17) + ! 1:02:00 - brin - store only min/max or bloom-mask -- https://www.postgresql.org/docs/current/brin.html + ! good for cases like append-only logs with timestamps + ! https://www.postgresql.org/docs/16/brin-intro.html (? no from v17) + ! 1:10:00 - bloom - store only min/max or bloom-mask -- https://www.postgresql.org/docs/current/bloom.html + ! logic is the same as for hash + + +Tenzor - Backend School - PG Indices p1 of 1:10:44 https://www.youtube.com/watch?v=sNCKlklvGO0 + ! 11:00 - select relname, relpages from pg_class where relaname like 'idx_%'; -- for estimating idx size + ! 12:00 create index on ((field=val)) -- expr-base idx, but bad + ! 12:30 create index on (field) where field=val; -- partial/conditional ind - better because size of it is smaller + ! 15:00 pg has 3 types of expr: immutable, stable, volatile -- https://www.postgresql.org/docs/current/xfunc-volatility.html + ! only immutable are for idx + ! 21:00 create index concurrently - for helping queries not to wait, but concurrent-idxes can't be rolled back from transactions + ! 24:00 - create unique index ... alter table ... add primary key using index ... + ! 25:00 - select * from pg_stat_progress_create_index; -- https://www.postgresql.org/docs/current/progress-reporting.html + ! 27:00 - Uber - from PG to MySQL and back - https://habr.com/ru/companies/slurm/articles/322624/ + ! 28:00 - select * from pg_stat_user_indexes where idx_scan = 0; -- find not-used indexes + ! drop index concurrently; + ! 31:00 - index types - https://www.postgresql.org/docs/current/indexes-types.html + ! btree, hash, gist, spgist, gin, brin, xindex (https://www.postgresql.org/docs/current/xindex.html) + ! 33:00 btree - balanced tree, good for ordered types - https://www.postgresql.org/docs/current/btree.html + ! 36:00 btree uses prefix condition idx(a, b, c) - can be used for (a), (a, b) + ! 39:00 for conditions a <> .., a not in ... a <> any/all - index will be used very bad (search all the layer) + ! 44:00 for btree it is good to use field in cardinality grow order + ! 49:00 for btree array field using is bad + ! 51:00 ... null values - better to use conditional indexes - where a is not null or b is not null, where (a, b) is not null + ! 54:00 if we have 2 independent indexes for (a) and for (b), then select ... where a=1 and b=1; + ! will use use bitmap index scan, but with a lot of rows each + ! create idx on (a, b), create idx on (a) where v = 1; create idx on (?) where a=1 and b=1; + ! 58:00 suspicious Limit/Sort/Scan + ! better to put sorb-by field to index fields tail + ! 59:00 btree can be used for prefix like-search ... relname like 'pg\_class\_%' + ! 1:05:00 - create index on prefix(md5 text_pattern_ops) -- use uperator-class text_pattern_ops 2022 Percona - A Deep Dive Into PostgreSQL Indexing - Ibrar Ahmad 0:00 of 46:10 https://www.youtube.com/watch?v=7OvrBmxW_e8 diff --git a/db/sql/postgres/feature/performance/planner/statistics.txt b/db/sql/postgres/feature/performance/planner/statistics.txt index c393eef91..1d181507c 100644 --- a/db/sql/postgres/feature/performance/planner/statistics.txt +++ b/db/sql/postgres/feature/performance/planner/statistics.txt @@ -1,3 +1,6 @@ +https://www.postgresql.org/docs/current/sql-createstatistics.html + !!! alter table ... alter column ... set statistics [0..10000] -- columns of hystogram (max 10000 per column) + https://www.postgresql.org/docs/current/planner-stats.html https://www.postgresql.org/docs/current/multivariate-statistics-examples.html diff --git a/pl/java/libfws/mapping/mapstruct.txt b/pl/java/libfws/mapping/mapstruct.txt deleted file mode 100644 index 476fc3853..000000000 --- a/pl/java/libfws/mapping/mapstruct.txt +++ /dev/null @@ -1,50 +0,0 @@ -http://mapstruct.org/ - -spring extensions -https://mapstruct.org/documentation/spring-extensions/reference/html/ -https://github.com/mapstruct/mapstruct-spring-extensions - -https://github.com/mapstruct/mapstruct -https://github.com/mapstruct/mapstruct-examples - -http://mapstruct.org/documentation/ -http://mapstruct.org/documentation/installation/ - -http://mapstruct.org/documentation/reference-guide/ -http://mapstruct.org/documentation/stable/reference/html/ - -lombok-int -'org.projectlombok:lombok-mapstruct-binding:0.2.0' -provided - If you are using Lombok 1.18.16 or newer you also need to add lombok-mapstruct-binding in order to make Lombok and MapStruct work together. -https://www.baeldung.com/java-mapstruct-lombok - -idea-plugin -https://plugins.jetbrains.com/plugin/10036-mapstruct-support -https://github.com/mapstruct/mapstruct-idea - -baeldung -https://www.baeldung.com/tag/mapstruct -https://www.baeldung.com/mapstruct -2024 -https://habr.com/ru/articles/818489/ - https://github.com/yayauheny/javanotice-mapstruct -2022 -https://reflectoring.io/java-mapping-with-mapstruct/ - https://github.com/thombergs/code-examples/tree/master/mapstruct - ! @MappingTarget - for updating existing instances - !!! Exceptions throwing during mapping - ! using Formatters - ! mapping collections, streams, enums - ! default values/expressions and constraints - ! @DecoratedWith, @BeforeMapping, @AfterMapping - ! additional cfg-options -2020 -Lviv JavaClub - [Event 159] - MapStruct 0:00 of 1:05:32 - https://www.youtube.com/watch?v=0fNKc0daZ-c -2018 -https://habr.com/post/433270/ - -src -https://mapstruct.org/documentation/stable/api/org/mapstruct/Mapping.html - https://github.com/mapstruct/mapstruct/blob/main/core/src/main/java/org/mapstruct/Mapping.java diff --git a/pl/java/libfws/mapping/mapstruct/articles.txt b/pl/java/libfws/mapping/mapstruct/articles.txt new file mode 100644 index 000000000..e60a591ec --- /dev/null +++ b/pl/java/libfws/mapping/mapstruct/articles.txt @@ -0,0 +1,21 @@ +baeldung +https://www.baeldung.com/tag/mapstruct +https://www.baeldung.com/mapstruct +2024 +https://habr.com/ru/articles/818489/ + https://github.com/yayauheny/javanotice-mapstruct +2022 +https://reflectoring.io/java-mapping-with-mapstruct/ + https://github.com/thombergs/code-examples/tree/master/mapstruct + ! @MappingTarget - for updating existing instances + !!! Exceptions throwing during mapping + ! using Formatters + ! mapping collections, streams, enums + ! default values/expressions and constraints + ! @DecoratedWith, @BeforeMapping, @AfterMapping + ! additional cfg-options +2020 +Lviv JavaClub - [Event 159] - MapStruct 0:00 of 1:05:32 + https://www.youtube.com/watch?v=0fNKc0daZ-c +2018 +https://habr.com/post/433270/ diff --git a/pl/java/libfws/mapping/mapstruct/features/enum-mapping.txt b/pl/java/libfws/mapping/mapstruct/features/enum-mapping.txt new file mode 100644 index 000000000..af4ca56b4 --- /dev/null +++ b/pl/java/libfws/mapping/mapstruct/features/enum-mapping.txt @@ -0,0 +1,6 @@ +2022 +https://reflectoring.io/java-mapping-with-mapstruct/#mapping-enums + @ValueMappings/@ValueMapping + / + @EnumMapping(nameTransformationStrategy="...") + strategies: suffix, stripSuffix, prefix, stripPrefix diff --git a/pl/java/libfws/mapping/mapstruct/mapstruct.txt b/pl/java/libfws/mapping/mapstruct/mapstruct.txt new file mode 100644 index 000000000..a8245725b --- /dev/null +++ b/pl/java/libfws/mapping/mapstruct/mapstruct.txt @@ -0,0 +1,24 @@ +http://mapstruct.org/ + +spring extensions +https://mapstruct.org/documentation/spring-extensions/reference/html/ +https://github.com/mapstruct/mapstruct-spring-extensions + +https://github.com/mapstruct/mapstruct +https://github.com/mapstruct/mapstruct-examples + +http://mapstruct.org/documentation/ +http://mapstruct.org/documentation/installation/ + +http://mapstruct.org/documentation/reference-guide/ +http://mapstruct.org/documentation/stable/reference/html/ + +lombok-int +'org.projectlombok:lombok-mapstruct-binding:0.2.0' +provided + If you are using Lombok 1.18.16 or newer you also need to add lombok-mapstruct-binding in order to make Lombok and MapStruct work together. +https://www.baeldung.com/java-mapstruct-lombok + +idea-plugin +https://plugins.jetbrains.com/plugin/10036-mapstruct-support +https://github.com/mapstruct/mapstruct-idea diff --git a/pl/java/libfws/mapping/mapstruct/src.txt b/pl/java/libfws/mapping/mapstruct/src.txt new file mode 100644 index 000000000..36b2fecc0 --- /dev/null +++ b/pl/java/libfws/mapping/mapstruct/src.txt @@ -0,0 +1,2 @@ +https://mapstruct.org/documentation/stable/api/org/mapstruct/Mapping.html + https://github.com/mapstruct/mapstruct/blob/main/core/src/main/java/org/mapstruct/Mapping.java diff --git a/science/ai/free/deepsek.txt b/science/ai/free/deepsek.txt index 9bfef7861..c7bd4e88b 100644 --- a/science/ai/free/deepsek.txt +++ b/science/ai/free/deepsek.txt @@ -3,5 +3,7 @@ https://github.com/deepseek-ai https://api-docs.deepseek.com/quick_start/pricing 2025 +Aiii - DeepSeq v3 + make 0:00 of 23:40 + https://www.youtube.com/watch?v=9Xb6KpVl9dQ Makarov - DeepSeq v3 now free 0:00 of 6:29 https://www.youtube.com/watch?v=cNXTGOy6FQQ