pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomasz Ostrowski <tometzky@batory.org.pl>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Drupal and PostgreSQL - performance issues?
Date: Thu, 16 Oct 2008 17:26:24 +0200
Message-ID: <48F75D20.2070908@batory.org.pl> (raw)
In-Reply-To: <20081016144046.GH4452@tamriel.snowman.net>
References: <a93e6cbe-0000-4000-9a34-4db3620c619d@mm>
	<C6449FCD-198D-4A04-BACB-1BB2F20DD5B1@hoegh.org>
	<48F4F053.1060201@hagander.net>
	<F933F17A-70BC-4DB0-9491-9EEF0E79ABD9@hoegh.org>
	<b42b73150810141422i5ad693a8la3966fa6334c23f7@mail.gmail.com>
	<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>

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

Attachments:

drupal_lookup_path-5.x.patch.txt (text/plain, 1.1K) download 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];

view thread (68+ messages)  latest in thread

Message-ID: <48F75D20.2070908@batory.org.pl>
Permalink:  ../48F75D20.2070908@batory.org.pl/
Also on:    postgresql.org/message-id/48F75D20.2070908@batory.org.pl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tometzky@batory.org.pl, pgsql-general@postgresql.org
  Subject: Re: Drupal and PostgreSQL - performance issues?
  In-Reply-To: <48F75D20.2070908@batory.org.pl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox