NDirectFileRead and Write

Поиск
Список
Период
Сортировка
От ITAGAKI Takahiro
Тема NDirectFileRead and Write
Дата
Msg-id 20080801155433.7776.52131E4D@oss.ntt.co.jp
обсуждение исходный текст
Ответы Re: NDirectFileRead and Write  (ITAGAKI Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
Список pgsql-hackers
Hello,

I'd like to use NDirectFileRead and NDirectFileWrite statistics counters
for counting reads and writes in BufFile. They are defined, but not used
now. BufFile is used for tuple sorting or materializing, so we could use
NDirectFileRead/Write to retrieve how many I/Os are done in temp tablespace.

We can get the values of NDirectFileRead/Write when we enable
log_statement_stats, log_parser_stats, log_planner_stats or
log_executor_stats. (They show always 0 for NDirectFile R/W now.)

I have a plan to store the values shown by log_xxx_stats into
pg_stat_statements, that is per-query statistics information collector
I'm developing. The combination of NDirectFile R/W and pg_stat_statements
have an advantage to detect which sql uses large tuple sorting.
And after we find such queries, we can turn trace_sort on and examine
how amount of work_mem is needed by such queries. We could save time
for tuning queries and reading server logs.



-- The patch would be very trivial ;-)

Index: src/backend/storage/file/buffile.c
===================================================================
--- src/backend/storage/file/buffile.c    (HEAD)
+++ src/backend/storage/file/buffile.c    (working copy)
@@ -238,6 +238,7 @@        file->nbytes = 0;    file->offsets[file->curFile] += file->nbytes;    /* we choose not to
advancecurOffset here */
 
+    NDirectFileRead++;}/*
@@ -300,6 +301,7 @@        file->offsets[file->curFile] += bytestowrite;        file->curOffset += bytestowrite;
wpos+= bytestowrite;
 
+        NDirectFileWrite++;    }    file->dirty = false;

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Lor
Дата:
Сообщение: Re: Review: DTrace probes (merged version) ver_03
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: Plans for 8.4