Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gpIxN-0007dy-Bk for pgsql-hackers@arkaria.postgresql.org; Thu, 31 Jan 2019 20:29:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gpIxM-0005tt-4z for pgsql-hackers@arkaria.postgresql.org; Thu, 31 Jan 2019 20:29:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gpIxL-0005tm-TP for pgsql-hackers@lists.postgresql.org; Thu, 31 Jan 2019 20:29:03 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gpIxI-0000g1-OS for pgsql-hackers@lists.postgresql.org; Thu, 31 Jan 2019 20:29:03 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x0VKSviK009004; Thu, 31 Jan 2019 15:28:57 -0500 From: Tom Lane To: Robert Haas cc: PostgreSQL Hackers Subject: Re: Proposed refactoring of planner header files In-reply-to: References: <11460.1548706639@sss.pgh.pa.us> <30320.1548904075@sss.pgh.pa.us> <11671.1548963958@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Thu, 31 Jan 2019 15:10:17 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <9002.1548966537.1@sss.pgh.pa.us> Date: Thu, 31 Jan 2019 15:28:57 -0500 Message-ID: <9003.1548966537@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > I do not have a powerful opinion on exactly what to do here, but I > offer the following for what it's worth: > - I do not really think much of the selfuncs.c naming. Nobody who is > not deeply immersed in the PostgreSQL code knows what a "selfunc" is. > Therefore, breaking selfuncs.c into opr_selfuncs.c and > index_selfuncs.c doesn't strike me as the ideal naming choice. I > would suggest looking for a name that is less steeped in venerable > tradition; perhaps estimator.c or indexsupport.c or selectivity.c or > whatever could be considered for whatever new files we are creating. Hm. I'm not really persuaded. There isn't any part of this code that isn't "steeped in venerable tradition"; the problem I'm ultimately trying to fix here can fairly be characterized as 25-year-old technical debt. I see your point that adt/ is not where new people might look for selectivity estimators, but we should also have some sympathy for people who *do* know the code base expecting to find these functions more or less where they are. > - I have always found the placement of selfuncs.c a bit strange: why > is it in utils/adt? Perhaps there is an argument for having the > things that are specific to a particular type or a particular operator > in that directory, but if so, shouldn't they be grouped with the type > or operator to which they relate, rather than each other? We do already have that to some extent: src/backend/tsearch/ts_selfuncs.c src/backend/utils/adt/array_selfuncs.c src/backend/utils/adt/rangetypes_selfuncs.c src/backend/utils/adt/geo_selfuncs.c src/backend/utils/adt/network_selfuncs.c src/backend/utils/adt/selfuncs.c src/include/utils/index_selfuncs.h src/include/utils/selfuncs.h contrib/intarray/_int_selfuncs.c Breaking up selfuncs.c would carry this a bit further, but giving it a random new name doesn't seem to me to really improve matters. Now, if we move the support functions to someplace under optimizer/, we do have to think about a name for that. I was considering optimizer/utils/selsupport.c and optimizer/selsupport.h, but I'm certainly not wedded to that. regards, tom lane