Re: directory tree query with big planner variation

Michael Stone <mstone+postgres@mathom.us>

From: Michael Stone <mstone+postgres@mathom.us>
To: Axel Rau <Axel.Rau@Chaos1.DE>
Cc: pgsql-performance@postgresql.org
Date: 2006-07-31T11:15:42Z
Lists: pgsql-performance
On Mon, Jul 31, 2006 at 12:48:11PM +0200, Axel Rau wrote:
>               WHERE P.path ~ '^%@/[^/]*/$' ) AS NLPC

This can't be indexed. You might try something like 
WHERE P.path LIKE '%@%' AND P.path ~ '^%@/[^/]*/$'

The schema could be a lot more intelligent here. (E.g., store path 
seperately from file/directory name, store type (file or directory) 
seperately, etc.) Without improving the schema I don't think this will 
ever be a speed demon.

Mike Stone