Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-23 Thread Gurjeet Singh
On Fri, Feb 18, 2011 at 1:36 PM, Heikki Linnakangas < heikki.linnakan...@enterprisedb.com> wrote: > On 18.02.2011 17:02, Gurjeet Singh wrote: > > Another use case of the Index Advisor is to be switched on for a few hours >> while the application runs, and gather the recommendations for the whole

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-18 Thread Tom Lane
Heikki Linnakangas writes: > On 18.02.2011 17:02, Gurjeet Singh wrote: >>> On Wed, Feb 16, 2011 at 6:37 PM, Tom Lane wrote: Fetch the values you need and stuff 'em in the struct. Don't expect relcache to do it for you. >>> I also wish to make Index Advisor faster by not having to loo

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-18 Thread Heikki Linnakangas
On 18.02.2011 17:02, Gurjeet Singh wrote: On Fri, Feb 18, 2011 at 2:27 AM, Heikki Linnakangas< heikki.linnakan...@enterprisedb.com> wrote: On 17.02.2011 14:30, Gurjeet Singh wrote: On Wed, Feb 16, 2011 at 6:37 PM, Tom Lane wrote: Fetch the values you need and stuff 'em in the struct. Don

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-18 Thread Gurjeet Singh
On Fri, Feb 18, 2011 at 2:27 AM, Heikki Linnakangas < heikki.linnakan...@enterprisedb.com> wrote: > On 17.02.2011 14:30, Gurjeet Singh wrote: > >> On Wed, Feb 16, 2011 at 6:37 PM, Tom Lane wrote: >> >> Fetch the values you need and stuff 'em in the struct. Don't expect >>> relcache to do it for

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-17 Thread Heikki Linnakangas
On 17.02.2011 14:30, Gurjeet Singh wrote: On Wed, Feb 16, 2011 at 6:37 PM, Tom Lane wrote: Gurjeet Singh writes: On Wed, Feb 16, 2011 at 10:25 AM, Tom Lane wrote: The only reason you'd need that code is if you were trying to construct a fake Relation structure, which seems unnecessary and

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-17 Thread Gurjeet Singh
On Wed, Feb 16, 2011 at 6:37 PM, Tom Lane wrote: > Gurjeet Singh writes: > > On Wed, Feb 16, 2011 at 10:25 AM, Tom Lane wrote: > >> The only reason you'd need that code is if you were trying to construct > >> a fake Relation structure, which seems unnecessary and undesirable. > > > The planner

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-16 Thread Gurjeet Singh
On Wed, Feb 16, 2011 at 7:25 PM, Tom Lane wrote: > Gurjeet Singh writes: > > On Wed, Feb 16, 2011 at 10:26 AM, Tom Lane wrote: > >> Yeah, hypothetical is the more-established term I think. > > > Please find the patch attached. > > Applied with minor adjustments to HEAD and 9.0. > Thanks Tom. -

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-16 Thread Thom Brown
On 17 February 2011 00:48, Tom Lane wrote: > Thom Brown writes: >> For my benefit, could you explain how ishypothetical gets set to true? > > In the core, it never does.  An index advisor plugin would set it in > IndexOptInfo structs that it makes. I get the idea. Thanks Tom. -- Thom Brown Tw

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-16 Thread Tom Lane
Thom Brown writes: > For my benefit, could you explain how ishypothetical gets set to true? In the core, it never does. An index advisor plugin would set it in IndexOptInfo structs that it makes. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@p

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-16 Thread Thom Brown
On 16 February 2011 23:02, Gurjeet Singh wrote: > On Wed, Feb 16, 2011 at 10:26 AM, Tom Lane wrote: >> >> Gurjeet Singh writes: >> >     BTW, you use the term 'fictitious' in the comments, would it be >> > better >> > to standardize the term used for such an index? So either the comment >> > wou

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-16 Thread Tom Lane
Gurjeet Singh writes: > On Wed, Feb 16, 2011 at 10:26 AM, Tom Lane wrote: >> Yeah, hypothetical is the more-established term I think. > Please find the patch attached. Applied with minor adjustments to HEAD and 9.0. regards, tom lane -- Sent via pgsql-hackers mailing

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-16 Thread Tom Lane
Gurjeet Singh writes: > On Wed, Feb 16, 2011 at 10:25 AM, Tom Lane wrote: >> The only reason you'd need that code is if you were trying to construct >> a fake Relation structure, which seems unnecessary and undesirable. > The planner requires IndexOptInfo, and for the planner to choose the > hyp

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-16 Thread Gurjeet Singh
On Wed, Feb 16, 2011 at 10:26 AM, Tom Lane wrote: > Gurjeet Singh writes: > > BTW, you use the term 'fictitious' in the comments, would it be > better > > to standardize the term used for such an index? So either the comment > would > > be changed to call it hypothetical, or the structure me

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-16 Thread Gurjeet Singh
On Wed, Feb 16, 2011 at 10:25 AM, Tom Lane wrote: > Gurjeet Singh writes: > > I understand that we need to hide guts of an implementation. But without > > this the Index Advisor will have to emulate what LookupOpclassInfo() does > > and that's a lot of code that I am afraid, if emulated by anoth

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-16 Thread Tom Lane
Gurjeet Singh writes: > BTW, you use the term 'fictitious' in the comments, would it be better > to standardize the term used for such an index? So either the comment would > be changed to call it hypothetical, or the structure member would be changed > to isfictitious. Yeah, hypothetical is

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-16 Thread Tom Lane
Gurjeet Singh writes: > I understand that we need to hide guts of an implementation. But without > this the Index Advisor will have to emulate what LookupOpclassInfo() does > and that's a lot of code that I am afraid, if emulated by another function > in Index Advisor, is more prone to obsolecence

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-16 Thread Gurjeet Singh
On Tue, Feb 15, 2011 at 12:51 PM, Tom Lane wrote: > Gurjeet Singh writes: > > On Tue, Feb 15, 2011 at 8:24 AM, Heikki Linnakangas < > > heikki.linnakan...@enterprisedb.com> wrote: > >> On 11.02.2011 22:44, Gurjeet Singh wrote: > >>> One one hand get_actual_variable_range() expects that virtual i

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-16 Thread Gurjeet Singh
On Tue, Feb 15, 2011 at 11:59 AM, Tom Lane wrote: > Gurjeet Singh writes: > > Also attached is the patch expose_IndexSupportInitialize.patch, that > makes > > the static function IndexSupportInitialize() global so that the Index > > Advisor doesn't have to reinvent the wheel to prepare an index

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-15 Thread Tom Lane
Gurjeet Singh writes: > On Tue, Feb 15, 2011 at 8:24 AM, Heikki Linnakangas < > heikki.linnakan...@enterprisedb.com> wrote: >> On 11.02.2011 22:44, Gurjeet Singh wrote: >>> One one hand get_actual_variable_range() expects that virtual indexes do >>> not >>> have an OID assigned, on the other hand

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-15 Thread Tom Lane
Gurjeet Singh writes: > Also attached is the patch expose_IndexSupportInitialize.patch, that makes > the static function IndexSupportInitialize() global so that the Index > Advisor doesn't have to reinvent the wheel to prepare an index structure > with opfamilies and opclasses. We are *not* doing

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-15 Thread Gurjeet Singh
On Tue, Feb 15, 2011 at 8:24 AM, Heikki Linnakangas < heikki.linnakan...@enterprisedb.com> wrote: > On 11.02.2011 22:44, Gurjeet Singh wrote: > >> Looks like the function get_actual_variable_range() was written with the >> knowledge that virtual/hypothetical indexes may exist, but the assumption

Re: [HACKERS] Fix for Index Advisor related hooks

2011-02-15 Thread Heikki Linnakangas
On 11.02.2011 22:44, Gurjeet Singh wrote: Looks like the function get_actual_variable_range() was written with the knowledge that virtual/hypothetical indexes may exist, but the assumption seems wrong. One one hand get_actual_variable_range() expects that virtual indexes do not have an OID ass

[HACKERS] Fix for Index Advisor related hooks

2011-02-11 Thread Gurjeet Singh
Looks like the function get_actual_variable_range() was written with the knowledge that virtual/hypothetical indexes may exist, but the assumption seems wrong. One one hand get_actual_variable_range() expects that virtual indexes do not have an OID assigned, on the other hand explain_get_index_na