Код: Выделить всё
reads (
id bigint,
input_id integer,
reg_date TIMESTAMP NOT NULL)
И запрос
Код: Выделить всё
SELECT max(r.reg_date), input_id FROM reads r GROUP BY input_id
Код: Выделить всё
Plan
------------------------------------------------
PLAN (R ORDER FK_READS_1)
Adapted Plan
------------------------------------------------
PLAN (R ORDER FK_READS_1)
Query Time
------------------------------------------------
Prepare : 31,00 ms
Execute : 109 141,00 ms
Avg fetch time: 5 197,19 ms
Memory
------------------------------------------------
Current: 23 435 388
Max : 143 154 736
Buffers: 25 000
Operations
------------------------------------------------
Read : 1 009 574
Writes : 157 824
Fetches: 32 005 774
Enchanced Info:
+--------------------------+-----------+-----------+-------------+---------+---------+---------+
| Table Name | Records | Indexed | Non-Indexed | Updates | Deletes | Inserts |
| | Total | reads | reads | | | |
+--------------------------+-----------+-----------+-------------+---------+---------+---------+
| READS| 0 | 10127946 | 0 | 0 | 0 | 0 |
+--------------------------+-----------+-----------+-------------+---------+---------+---------+
Код: Выделить всё
Query
------------------------------------------------
SELECT max(r.reg_date) as maks, input_id as d FROM reads r GROUP BY input_id plan (r natural)
Plan
------------------------------------------------
PLAN SORT ((R NATURAL))
Adapted Plan
------------------------------------------------
PLAN SORT ((R NATURAL))
Query Time
------------------------------------------------
Prepare : 31,00 ms
Execute : 22 562,00 ms
Avg fetch time: 1 074,38 ms
Memory
------------------------------------------------
Current: 10 454 576
Max : 10 490 560
Buffers: 25 000
Operations
------------------------------------------------
Read : 63 797
Writes : 0
Fetches: 14 155 323
Enchanced Info:
+--------------------------+-----------+-----------+-------------+---------+---------+---------+
| Table Name | Records | Indexed | Non-Indexed | Updates | Deletes | Inserts |
| | Total | reads | reads | | | |
+--------------------------+-----------+-----------+-------------+---------+---------+---------+
| READS| 0 | 0 | 7013881 | 0 | 0 | 0 |
+--------------------------+-----------+-----------+-------------+---------+---------+---------+