Этот коммит содержится в:
Ihar Hancharenka 2025-01-08 13:39:32 +03:00
родитель 06d3bde83e
Коммит 42639fb2e4
13 изменённых файлов: 141 добавлений и 57 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -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

Просмотреть файл

@ -0,0 +1 @@
https://www.postgresql.org/docs/current/runtime-config-autovacuum.html

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -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 <tbl>((field=val)) -- expr-base idx, but bad
! 12:30 create index on <tbl>(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

Просмотреть файл

@ -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

Просмотреть файл

@ -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'
<scope>provided</scope>
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

Просмотреть файл

@ -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/

Просмотреть файл

@ -0,0 +1,6 @@
2022
https://reflectoring.io/java-mapping-with-mapstruct/#mapping-enums
@ValueMappings/@ValueMapping
<AnyRamaining>/<AnyUnmapped>
@EnumMapping(nameTransformationStrategy="...")
strategies: suffix, stripSuffix, prefix, stripPrefix

Просмотреть файл

@ -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'
<scope>provided</scope>
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

2
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

Просмотреть файл

@ -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