Re: Index on function less well cached than "regular" index ? - Mailing list pgsql-performance

From Tom Lane
Subject Re: Index on function less well cached than "regular" index ?
Date
Msg-id 7022.1145916704@sss.pgh.pa.us
Whole thread Raw
In response to Index on function less well cached than "regular" index ?  ("Paul Mackay" <mackaypaul@gmail.com>)
List pgsql-performance
"Paul Mackay" <mackaypaul@gmail.com> writes:
> ...
> EXPLAIN shows that an index scan is used by the planner. A query returning
> the maximum 200 number of records takes around 20 ms. What is surprising is
> that the same query executed several times takes practically the same time,
> as if the result was not cached.
> ...
> Could the problem be that an index on a function result is not cached or
> less well cached ?

I can't see how that would be.  The index machinery has no idea what
it's indexing, and the kernel disk cache even less.

Perhaps the majority of the runtime is going somewhere else, like the
initial evaluation of the function value to compare against?  Or maybe
you've found some inefficiency in the planner's handling of function
indexes.  Try comparing EXPLAIN ANALYZE output for the two cases to see
if the discrepancy exists during query runtime, or if it's upstream at
plan time.

            regards, tom lane

pgsql-performance by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: GROUP BY Vs. Sub SELECT
Next
From: "Sriram Dandapani"
Date:
Subject: ip address data type