Bruce Momjian wrote:

Here is what you can do:

SELECT filename, (SELECT file_len FROM pg_file_stat(filename)),
(SELECT file_ctime FROM pg_file_stat(filename)),
(SELECT file_mtime FROM pg_file_stat(filename)),
(SELECT file_atime FROM pg_file_stat(filename))
FROM pg_dir_ls('/etc') AS d (filename text...)
WHERE filename like 's%'

Not really satisfying (pg_file_stat is volatile) but subselects give the desired result.

Are we done? Seems pg_file_stat() works fine. Do we need other adjustments?

The only single spot where performance could be improved is in pg_file_stat, where attinmeta is created again and again; this may be cached in a static memory context instead.

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Reply via email to