Re: SQLF Optimization question

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Werner Echezuria <wercool(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: SQLF Optimization question
Date: 2007-05-31 18:59:53
Message-ID: 20070531185953.GB25571@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 31, 2007 at 09:58:27AM -0400, Werner Echezuria wrote:
> Hello, (First of all, sorry for my english),
>
> I'm in a project that involves including sqlf sentences to make postgres
> understand the fuzzy querys, i mean, make people to create fuzzy
> predicates, these are words like fat, tall, young, old, in an sql sentence.
> I guess the first step is complete. The parser know when an user writes
> "CREATE FUZZY PREDICATE <name> ON <domain> AS <fuzzy set>".
>
> For instance, a person can create the young word as a fuzzy predicate like
> this: "CREATE FUZZY PREDICATE young ON 0..120 AS (0,0,25,50)", that means,
> in a domain of 0..120 a young person is between 25 and 50. The fuzzy set has
> the follows: (beg,core1,core2,end), (begin of the set, first core, second
> core, end of the set).
>
> The sentence creates a row in a catalog named "pg_fuzzypred", and we're good
> till then.
>
> But when I write "Select * from students where age=young", brings me a
> message telling me the node isn't exist. My teacher who is very involved in
> the project tells me that postgres has to do the derivation principle,
> before it gets to the executor (what sounds logical), in order to the
> optimizer calculates all costs properly.

Ok, I didn't totally follow the patch, but it seems to be you need to,
somewhere, get postgres to see an unadorned word as a fuzzy predicate.
Somewhere involving IDENT probably.

However, it seems to me you're opening yourself up to problems, what if
someone has a column name the same as your fuzzy predicate? I suggest
you also add syntax for the matching, something like:

Select * from students where age FUZZYMATCH young;

This means that you don't interfere with existing grammer, but you have
your own bit which you can completely control.

Hope this helps,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-05-31 19:38:05 Hash joins vs small-integer join values
Previous Message Josh Berkus 2007-05-31 17:39:45 Re: Query plan degradation 8.2 --> 8.3