X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 04102529EE for ; Thu, 7 Jul 2005 22:02:14 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38007-09 for ; Fri, 8 Jul 2005 01:02:10 +0000 (GMT) Received: from davinci.ethosmedia.com (server227.ethosmedia.com [209.128.84.227]) by svr1.postgresql.org (Postfix) with ESMTP id 924E9529E5 for ; Thu, 7 Jul 2005 22:02:09 -0300 (ADT) X-EthosMedia-Virus-Scanned: no infections found Received: from [64.81.245.111] (account josh@agliodbs.com HELO temoku.sf.agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 7584349; Thu, 07 Jul 2005 18:04:22 -0700 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: Madison Kelly Subject: Re: Need suggestion high-level suggestion on how to solve a performance problem Date: Thu, 7 Jul 2005 18:04:28 -0700 User-Agent: KMail/1.8 Cc: pgsql-performance@postgresql.org References: <42CD2A7A.10603@alteeve.com> In-Reply-To: <42CD2A7A.10603@alteeve.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200507071804.29189.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.045 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200507/79 X-Sequence-Number: 13320 Madison, > =A0 =A0The 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. > > =A0 =A0What I need is a scheme for being able to say, essentially: > > UPDATE file_info_1 SET file_backup=3D't' WHERE file_parent_dir~'^/'; Well, from the sound of it the problem is not selecting the files to be=20 updated, it's updating them. =20 What I would do, personally, is *not* store an update flag for each file. = =20 Instead, I would store the update flag for the directory which was=20 selected. If users want to exclude certain files and subdirectories, I'd=20 also include a dont_update flag. When it's time to back up, you simply=20 check the tree for the most immediate update or don't update flag above=20 each file. =46or the table itself, I'd consider using ltree for the directory tree=20 structure. It has some nice features which makes it siginifcanly better=20 than using a delimited text field. =2D-=20 =2D-Josh Josh Berkus Aglio Database Solutions San Francisco