Re: Need suggestion high-level suggestion on how to solve a performance problem

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Need suggestion high-level suggestion on how to solve a performance problem
Дата
Msg-id 200507071804.29189.josh@agliodbs.com
обсуждение исходный текст
Ответ на Need suggestion high-level suggestion on how to solve a performance problem  (Madison Kelly <linux@alteeve.com>)
Список pgsql-performance
Madison,

>    The problem comes when the user toggles a directory branch's backup
> flag (a simple check box beside the directory name). If it's a directory
> near the end of a branch it is fast enough. If they toggle a single file
> it is nearly instant. However if they toggle say the root directory, so
> every file and directory below it needs to be updated, it can take
> 500-600sec to return. Obviously this is no good.
>
>    What I need is a scheme for being able to say, essentially:
>
> UPDATE file_info_1 SET file_backup='t' WHERE file_parent_dir~'^/';

Well, from the sound of it the problem is not selecting the files to be
updated, it's updating them.

What I would do, personally, is *not* store an update flag for each file.
Instead, I would store the update flag for the directory which was
selected.  If users want to exclude certain files and subdirectories, I'd
also include a dont_update flag.  When it's time to back up, you simply
check the tree for the most immediate update or don't update flag above
each file.

For the table itself, I'd consider using ltree for the directory tree
structure.  It has some nice features which makes it siginifcanly better
than using a delimited text field.

--
--Josh

Josh Berkus
Aglio Database Solutions
San Francisco

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

Предыдущее
От: PFC
Дата:
Сообщение: Re: Need suggestion high-level suggestion on how to solve a performance problem
Следующее
От: Stuart Bishop
Дата:
Сообщение: Mount database on RAM disk?