Начало » Использование СУБД » Firebird, HQbird, InterBase » Fb 5.0.1.1329 очень медленный подсчет записей (Замедление запроса по сравнению с Fb 4)
Fb 5.0.1.1329 очень медленный подсчет записей [сообщение #4344] |
Mon, 05 February 2024 19:48 |
olegvk2000
Сообщений: 16 Зарегистрирован: February 2024
|
Junior Member |
|
|
Существенное замедление запроса по сравнению с Fb4
Выполнение скрипты около минуты раньше даже не обращал внимания почти мгновенно было ну уж точно не более пару секунд и это при том что раньше было в таблице около 30 млн записей
select count(*) from turist_list_detal
Записей: 18 971 605
PLAN (TURIST_LIST_DETAL NATURAL)
------ Информация о производительности ------
Время подготовки запроса = 0ms
Время выполнения запроса = 59s 968ms
Среднее время на получение одной записи = 59 968,00 ms
Current memory = 850 100 512
Max memory = 850 759 088
Memory buffers = 50 000
Reads from disk to cache = 185 058
Writes from cache to disk = 0
Чтений из кэша = 19 711 898
Скрипт таблицы с 19 млн записей
CREATE TABLE TURIST_LIST_DETAL (
UID T_UID NOT NULL /* T_UID = BIGINT NOT NULL */,
COD_COUNTRY T_COD_COUNTRY NOT NULL /* T_COD_COUNTRY = CHAR(3) */,
UID_LIST T_UID NOT NULL /* T_UID = BIGINT NOT NULL */,
UID_TRAVEL T_UID NOT NULL /* T_UID = BIGINT NOT NULL */,
LAST_NAME T_A64 NOT NULL /* T_A64 = VARCHAR(64) */,
FIRST_NAME T_A64 /* T_A64 = VARCHAR(64) */,
BIRTHDAY T_DATE /* T_DATE = DATE */,
POLIS_NUMBER T_A64 /* T_A64 = VARCHAR(64) */,
DATE_IN T_DATE NOT NULL /* T_DATE = DATE */,
DATE_OUT T_DATE NOT NULL /* T_DATE = DATE */,
FRANSHISE T_MONEY /* T_MONEY = NUMERIC(15,2) */,
KOL_DAY COMPUTED BY (CAST((DATE_OUT - DATE_IN + 1) as Integer)),
SUMMA_IC T_MONEY /* T_MONEY = NUMERIC(15,2) */,
SUMMA_IC_PREMIA T_MONEY DEFAULT 0 NOT NULL /* T_MONEY = NUMERIC(15,2) */,
COD_VALUT_IC T_COD_VALUT DEFAULT 'USD' NOT NULL /* T_COD_VALUT = CHAR(3) */,
IC_PROGRAM T_A3 /* T_A3 = VARCHAR(3) */,
IC_COD T_A3 /* T_A3 = VARCHAR(3) */,
IS_VIP COMPUTED BY ((select turist_list.is_vip from turist_list
where
(
(turist_list.uid = UID_LIST)
) ))
);
/*********************************************************** *******************/
/**** Primary keys ****/
/*********************************************************** *******************/
ALTER TABLE TURIST_LIST_DETAL ADD CONSTRAINT PK_TURIST_LIST_DETAL PRIMARY KEY (UID);
/*********************************************************** *******************/
/**** Foreign keys ****/
/*********************************************************** *******************/
ALTER TABLE TURIST_LIST_DETAL ADD CONSTRAINT FK_TURIST_LIST_DETAL_1 FOREIGN KEY (UID_LIST) REFERENCES TURIST_LIST (UID) ON DELETE CASCADE ON UPDATE CASCADE;
ALTER TABLE TURIST_LIST_DETAL ADD CONSTRAINT FK_TURIST_LIST_DETAL_2 FOREIGN KEY (COD_COUNTRY) REFERENCES COUNTRY (COD_COUNTRY) ON UPDATE CASCADE;
ALTER TABLE TURIST_LIST_DETAL ADD CONSTRAINT FK_TURIST_LIST_DETAL_3 FOREIGN KEY (UID_TRAVEL) REFERENCES CLIENTS (UID) ON UPDATE CASCADE;
/*********************************************************** *******************/
/**** Indices ****/
/*********************************************************** *******************/
CREATE INDEX TURIST_LIST_DETAL_IDX1 ON TURIST_LIST_DETAL (POLIS_NUMBER);
CREATE DESCENDING INDEX TURIST_LIST_DETAL_IDX_DATE_IN ON TURIST_LIST_DETAL (DATE_IN);
CREATE DESCENDING INDEX TURIST_LIST_DETAL_IDX_DATE_OUT ON TURIST_LIST_DETAL (DATE_OUT);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Fb 5.0.1.1329 очень медленный подсчет записей [сообщение #4367 является ответом на сообщение #4366] |
Tue, 06 February 2024 13:57 |
olegvk2000
Сообщений: 16 Зарегистрирован: February 2024
|
Junior Member |
|
|
По FB4
Database "C:\KOVSOFT\BASA5\MA4.FDB"
Gstat execution time Tue Feb 6 13:51:57 2024
Database header page information:
Flags 0
Generation 1677
System Change Number 0
Page size 16384
ODS version 13.0
Oldest transaction 1660
Oldest active 1661
Oldest snapshot 1661
Next transaction 1661
Sequence number 0
Next attachment ID 34
Implementation HW=AMD/Intel/x64 little-endian OS=Windows CC=MSVC
Shadow count 0
Page buffers 50000
Next header page 0
Database dialect 3
Creation date Feb 5, 2024 17:04:52
Attributes force write
Variable header data:
Database GUID: {900216C3-8B2C-4757-964A-46CD9AFF2243}
Sweep interval: 20000
*END*
Database file sequence:
File C:\KOVSOFT\BASA5\MA4.FDB is the only file
Analyzing database pages ...
TURIST_LIST_DETAL (132)
Primary pointer page: 191, Index root page: 192
Total formats: 2, used formats: 1
Average record length: 97.75, total records: 18971605
Average version length: 0.00, total versions: 0, max versions: 0
Average fragment length: 0.00, total fragments: 0, max fragments: 0
Average unpacked length: 304.00, compression ratio: 3.11
Pointer pages: 52, data page slots: 167728
Data pages: 167728, average fill: 79%
Primary pages: 167728, secondary pages: 0, swept pages: 0
Empty pages: 3, full pages: 167724
Fill distribution:
0 - 19% = 3
20 - 39% = 0
40 - 59% = 1
60 - 79% = 147305
80 - 99% = 20419
Index FK_TURIST_LIST_DETAL_1 (6)
Root page: 605497, depth: 3, leaf buckets: 6543, nodes: 18971605
Average node length: 5.59, total dup: 18962763, max dup: 146447
Average key length: 2.01, compression ratio: 4.49
Average prefix length: 8.99, average data length: 0.01
Clustering factor: 169076, ratio: 0.01
Fill distribution:
0 - 19% = 0
20 - 39% = 0
40 - 59% = 1
60 - 79% = 0
80 - 99% = 6542
Index FK_TURIST_LIST_DETAL_2 (5)
Root page: 599352, depth: 3, leaf buckets: 6533, nodes: 18971605
Average node length: 5.58, total dup: 18971551, max dup: 12443789
Average key length: 2.00, compression ratio: 1.50
Average prefix length: 3.00, average data length: 0.00
Clustering factor: 459961, ratio: 0.02
Fill distribution:
0 - 19% = 0
20 - 39% = 0
40 - 59% = 1
60 - 79% = 0
80 - 99% = 6532
Index FK_TURIST_LIST_DETAL_3 (4)
Root page: 592879, depth: 3, leaf buckets: 6536, nodes: 18971605
Average node length: 5.58, total dup: 18971584, max dup: 10044101
Average key length: 2.00, compression ratio: 4.49
Average prefix length: 9.00, average data length: 0.00
Clustering factor: 172029, ratio: 0.01
Fill distribution:
0 - 19% = 0
20 - 39% = 0
40 - 59% = 1
60 - 79% = 0
80 - 99% = 6535
Index PK_TURIST_LIST_DETAL (0)
Root page: 539299, depth: 3, leaf buckets: 13636, nodes: 18971605
Average node length: 11.63, total dup: 0, max dup: 0
Average key length: 8.05, compression ratio: 1.12
Average prefix length: 3.95, average data length: 5.05
Clustering factor: 169038, ratio: 0.01
Fill distribution:
0 - 19% = 0
20 - 39% = 0
40 - 59% = 1
60 - 79% = 0
80 - 99% = 13635
Index TURIST_LIST_DETAL_IDX1 (3)
Root page: 565842, depth: 3, leaf buckets: 7912, nodes: 18971605
Average node length: 6.74, total dup: 12643564, max dup: 120290
Average key length: 3.16, compression ratio: 4.19
Average prefix length: 12.27, average data length: 0.94
Clustering factor: 8551390, ratio: 0.45
Fill distribution:
0 - 19% = 0
20 - 39% = 0
40 - 59% = 0
60 - 79% = 0
80 - 99% = 7912
Index TURIST_LIST_DETAL_IDX_DATE_IN (1)
Root page: 553704, depth: 3, leaf buckets: 6534, nodes: 18971605
Average node length: 5.58, total dup: 18969731, max dup: 120275
Average key length: 2.00, compression ratio: 2.00
Average prefix length: 3.99, average data length: 0.00
Clustering factor: 413885, ratio: 0.02
Fill distribution:
0 - 19% = 0
20 - 39% = 1
40 - 59% = 0
60 - 79% = 0
80 - 99% = 6533
Index TURIST_LIST_DETAL_IDX_DATE_OUT (2)
Root page: 560244, depth: 3, leaf buckets: 6534, nodes: 18971605
Average node length: 5.58, total dup: 18969693, max dup: 120275
Average key length: 2.00, compression ratio: 2.00
Average prefix length: 3.99, average data length: 0.00
Clustering factor: 1788664, ratio: 0.09
Fill distribution:
0 - 19% = 0
20 - 39% = 1
40 - 59% = 0
60 - 79% = 0
80 - 99% = 6533
Gstat completion time Tue Feb 6 13:52:05 2024
|
|
|
Re: Fb 5.0.1.1329 очень медленный подсчет записей [сообщение #4368 является ответом на сообщение #4367] |
Tue, 06 February 2024 13:58 |
olegvk2000
Сообщений: 16 Зарегистрирован: February 2024
|
Junior Member |
|
|
По пятерке
Database "C:\KOVSOFT\BASA5\MA5.FDB"
Gstat execution time Tue Feb 6 13:54:59 2024
Database header page information:
Flags 0
Generation 2000
System Change Number 0
Page size 16384
ODS version 13.1
Oldest transaction 2045
Oldest active 2046
Oldest snapshot 2046
Next transaction 2046
Sequence number 0
Next attachment ID 42
Implementation HW=AMD/Intel/x64 little-endian OS=Windows CC=MSVC
Shadow count 0
Page buffers 50000
Next header page 0
Database dialect 3
Creation date Feb 4, 2024 18:12:28
Attributes force write
Variable header data:
Database GUID: {3E334F4D-660C-4C1B-AC34-9F764706CD60}
Sweep interval: 20000
*END*
Database file sequence:
File C:\KOVSOFT\BASA5\MA5.FDB is the only file
Analyzing database pages ...
TURIST_LIST_DETAL (132)
Primary pointer page: 196, Index root page: 197
Total formats: 2, used formats: 1
Average record length: 112.60, total records: 18971605
Average version length: 0.00, total versions: 0, max versions: 0
Average fragment length: 0.00, total fragments: 0, max fragments: 0
Average unpacked length: 304.00, compression ratio: 2.70
Pointer pages: 57, data page slots: 185064
Data pages: 185064, average fill: 81%
Primary pages: 185064, secondary pages: 0, swept pages: 0
Empty pages: 5, full pages: 185057
Fill distribution:
0 - 19% = 5
20 - 39% = 1
40 - 59% = 0
60 - 79% = 3028
80 - 99% = 182030
Index FK_TURIST_LIST_DETAL_1 (6)
Root page: 648726, depth: 3, leaf buckets: 6589, nodes: 18971605
Average node length: 5.63, total dup: 18962763, max dup: 146447
Average key length: 2.01, compression ratio: 4.49
Average prefix length: 8.99, average data length: 0.01
Clustering factor: 193824, ratio: 0.01
Fill distribution:
0 - 19% = 1
20 - 39% = 0
40 - 59% = 0
60 - 79% = 0
80 - 99% = 6588
Index FK_TURIST_LIST_DETAL_2 (5)
Root page: 642528, depth: 3, leaf buckets: 6579, nodes: 18971605
Average node length: 5.62, total dup: 18971551, max dup: 12443789
Average key length: 2.00, compression ratio: 1.50
Average prefix length: 3.00, average data length: 0.00
Clustering factor: 502109, ratio: 0.03
Fill distribution:
0 - 19% = 1
20 - 39% = 0
40 - 59% = 0
60 - 79% = 0
80 - 99% = 6578
Index FK_TURIST_LIST_DETAL_3 (4)
Root page: 636004, depth: 3, leaf buckets: 6582, nodes: 18971605
Average node length: 5.62, total dup: 18971584, max dup: 10044101
Average key length: 2.00, compression ratio: 4.49
Average prefix length: 9.00, average data length: 0.00
Clustering factor: 191150, ratio: 0.01
Fill distribution:
0 - 19% = 1
20 - 39% = 0
40 - 59% = 0
60 - 79% = 0
80 - 99% = 6581
Index PK_TURIST_LIST_DETAL (0)
Root page: 582191, depth: 3, leaf buckets: 13682, nodes: 18971605
Average node length: 11.67, total dup: 0, max dup: 0
Average key length: 8.05, compression ratio: 1.12
Average prefix length: 3.95, average data length: 5.05
Clustering factor: 193444, ratio: 0.01
Fill distribution:
0 - 19% = 0
20 - 39% = 1
40 - 59% = 0
60 - 79% = 0
80 - 99% = 13681
Index TURIST_LIST_DETAL_IDX1 (3)
Root page: 608862, depth: 3, leaf buckets: 7958, nodes: 18971605
Average node length: 6.78, total dup: 12643564, max dup: 120290
Average key length: 3.16, compression ratio: 4.19
Average prefix length: 12.27, average data length: 0.94
Clustering factor: 8573712, ratio: 0.45
Fill distribution:
0 - 19% = 0
20 - 39% = 0
40 - 59% = 1
60 - 79% = 0
80 - 99% = 7957
Index TURIST_LIST_DETAL_IDX_DATE_IN (1)
Root page: 596640, depth: 3, leaf buckets: 6579, nodes: 18971605
Average node length: 5.62, total dup: 18969731, max dup: 120275
Average key length: 2.00, compression ratio: 2.00
Average prefix length: 3.99, average data length: 0.00
Clustering factor: 448070, ratio: 0.02
Fill distribution:
0 - 19% = 0
20 - 39% = 0
40 - 59% = 0
60 - 79% = 1
80 - 99% = 6578
Index TURIST_LIST_DETAL_IDX_DATE_OUT (2)
Root page: 603225, depth: 3, leaf buckets: 6579, nodes: 18971605
Average node length: 5.62, total dup: 18969693, max dup: 120275
Average key length: 2.00, compression ratio: 2.00
Average prefix length: 3.99, average data length: 0.00
Clustering factor: 1920575, ratio: 0.10
Fill distribution:
0 - 19% = 0
20 - 39% = 0
40 - 59% = 0
60 - 79% = 0
80 - 99% = 6579
Gstat completion time Tue Feb 6 13:55:07 2024
[Обновления: Tue, 06 February 2024 14:00] Известить модератора
|
|
|
|
|
|
|
|
|
Re: Fb 5.0.1.1329 очень медленный подсчет записей [сообщение #4375 является ответом на сообщение #4373] |
Tue, 06 February 2024 15:23 |
olegvk2000
Сообщений: 16 Зарегистрирован: February 2024
|
Junior Member |
|
|
Понятно
На четверке реально медленнее
План
------------------------------------------------------------ --------------------
PLAN (TURIST_LIST_DETAL NATURAL)
------ Информация о производительности ------
Время подготовки запроса = 16ms
Время выполнения запроса = 14s 937ms
Среднее время на получение одной записи = 14 937,00 ms
Current memory = 851 248 480
Max memory = 852 166 480
Memory buffers = 50 000
Reads from disk to cache = 167 775
Writes from cache to disk = 1
Чтений из кэша = 19 642 559
[Обновления: Tue, 06 February 2024 15:32] Известить модератора
|
|
|
|
Переход к форуму:
Текущее время: Sun Dec 22 14:05:25 GMT+3 2024
Общее время, затраченное на создание страницы: 0.01159 секунд
|