Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id AF362650127 for ; Thu, 16 Oct 2008 12:27:52 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 59229-01-10 for ; Thu, 16 Oct 2008 12:27:48 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from batyskaf.batory.org.pl (mail.batory.org.pl [62.89.72.199]) by postgresql.org (Postfix) with ESMTP id 1642465012B for ; Thu, 16 Oct 2008 12:27:46 -0300 (ADT) Received: from [192.168.32.156] (nat.spray.pl [83.143.40.15]) (authenticated bits=0) by batyskaf.batory.org.pl (8.13.8/8.13.8) with ESMTP id m9GFQK1j006526 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 16 Oct 2008 17:26:21 +0200 Message-ID: <48F75D20.2070908@batory.org.pl> Date: Thu, 16 Oct 2008 17:26:24 +0200 From: Tomasz Ostrowski User-Agent: Thunderbird 2.0.0.17 (Windows/20080914) MIME-Version: 1.0 To: pgsql-general Subject: Re: Drupal and PostgreSQL - performance issues? References: <48F4F053.1060201@hagander.net> <7438A981-4B6A-4E5A-A1E0-50432CDEFB00@hoegh.org> <48F6EE94.8010904@batory.org.pl> <4BE94DFB-8917-4175-9083-7DEABC30BD7F@hoegh.org> <48F70157.7010601@batory.org.pl> <20081016144046.GH4452@tamriel.snowman.net> In-Reply-To: <20081016144046.GH4452@tamriel.snowman.net> Content-Type: multipart/mixed; boundary="------------040700020704030704050100" X-Scanned-By: MIMEDefang 2.64 on 62.89.72.199 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.188 tagged_above=0 required=5 tests=RCVD_IN_BL_SPAMCOP_NET=2.188 X-Spam-Level: ** X-Archive-Number: 200810/692 X-Sequence-Number: 138941 This is a multi-part message in MIME format. --------------040700020704030704050100 Content-Type: text/plain; charset=ISO-8859-2; format=flowed Content-Transfer-Encoding: 7bit On 2008-10-16 16:40, Stephen Frost wrote: >> There is an issue report with lengthy discussion on drupal.org: >> http://drupal.org/node/196862 >> And a proposed patch: > > I don't see 'limit 1' anywhere in that patch.. Sorry - haven't checked it - I have checked only a 6.x version http://drupal.org/files/issues/drupal_lookup_path-6.x.patch.txt which is sane. This Earnie guy, the author, made a mistake in 5.x version. I've corrected 5.x based on 6.x. I've attached it. Maybe this time I'll get this right. Regards Tometzky -- ...although Eating Honey was a very good thing to do, there was a moment just before you began to eat it which was better than when you were... Winnie the Pooh --------------040700020704030704050100 Content-Type: text/plain; name="drupal_lookup_path-5.x.patch.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="drupal_lookup_path-5.x.patch.txt" Index: path.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/path.inc,v retrieving revision 1.13 diff -u -p -r1.13 path.inc --- path.inc 23 Dec 2006 22:04:52 -0000 1.13 +++ path.inc 4 Dec 2007 21:04:51 -0000 @@ -42,18 +42,18 @@ function drupal_init_path() { function drupal_lookup_path($action, $path = '') { // $map keys are Drupal paths and the values are the corresponding aliases static $map = array(), $no_src = array(); - static $count; + static $have_rows; // Use $count to avoid looking up paths in subsequent calls if there simply are no aliases - if (!isset($count)) { - $count = db_result(db_query('SELECT COUNT(pid) FROM {url_alias}')); + if (!isset($have_rows)) { + $have_rows = db_result(db_query('SELECT pid FROM {url_alias} LIMIT 1')); } if ($action == 'wipe') { $map = array(); $no_src = array(); } - elseif ($count > 0 && $path != '') { + elseif ($have_rows && $path != '') { if ($action == 'alias') { if (isset($map[$path])) { return $map[$path]; --------------040700020704030704050100--