[Pgpool-hackers] About query cache of pgpool-II

Huang Bambo bambo.huang at gmail.com
Thu Oct 13 13:15:52 UTC 2011


> So you "normalize" SQL string before hash it?
> I doubt it is doable. For example,
>
> SELECT 'abc'
> and
> select 'abc'
>
> will create same result but
>
> SELECT 'ABC'
> and
> select 'abc'
>
> will not. This is because SQL identifiers are not case sensitive, but
> string literals are case sensitive.  And without parsing query, we
> cannot know which one is identifiers and which one is string literals.

I understand what you mean. But I think,although the hash value of
both " SELECT 'ABC' " and "select 'ABC" must be diffirent but they
could point to the same result. And for example if you have executed "
SELECT 'ABC' " first and cached the result. Then you execute " sElEcT
'ABC' " for the first time, we can't find a hash value for it , so we
need to parse it, and then found it is the same as " SELECT 'ABC' ",
so there are two hash item pointed to the same chached item. If we
execute " sElEcT 'ABC' " again, we can find it is executed before and
can get data directelly from the cache.

For the
> SELECT 'ABC'
> and
> select 'abc'
situation,  they are diffirent SQL.

Bambo Huang


More information about the Pgpool-hackers mailing list