Re: missing indexes in indexlist with partitioned tables

2023-01-08 Thread David Rowley
On Tue, 6 Dec 2022 at 13:43, Arne Roland wrote: > That being said, attached patch should fix the issue reported below. I took a look over the v10 patch and ended up making adjustments to the tests. I didn't quite see the need for the test to be as extensive as you had them in v10. Neither join

Re: missing indexes in indexlist with partitioned tables

2022-12-05 Thread Arne Roland
Freund Sent: Tuesday, November 22, 2022 2:36:59 AM To: Arne Roland Cc: David Rowley; Amit Langote; pgsql-hackers; Zhihong Yu; Alvaro Herrera; Julien Rouhaud Subject: Re: missing indexes in indexlist with partitioned tables Hi, On 2022-11-02 01:50:38 +, Arne Roland wrote: > I mainly chan

Re: missing indexes in indexlist with partitioned tables

2022-11-21 Thread Andres Freund
Hi, On 2022-11-02 01:50:38 +, Arne Roland wrote: > I mainly changed the comments, the Assert and some casing. The tests have been failing for a while https://cirrus-ci.com/github/postgresql-cfbot/postgresql/commitfest/40/3452 https://api.cirrus-ci.com/v1/task/6190372803051520/logs/cores.log

Re: missing indexes in indexlist with partitioned tables

2022-11-01 Thread Arne Roland
Hi! I mainly changed the comments, the Assert and some casing. > From: David Rowley > Sent: Monday, October 3, 2022 00:51 > > * In the header comment in get_relation_info(), I don't think we need > to mention join removals explicitly. At a stretch, maybe mentioning > "unique proofs" might be

Re: missing indexes in indexlist with partitioned tables

2022-10-02 Thread Tom Lane
David Rowley writes: > * I can't quite figure out why you're doing "DROP TABLE a CASCADE;" in > inherits.sql. You've not changed anything else in that file. Did you > mean to do this in join.sql? Doing that would be a bad idea no matter where it's done. IIRC, those tables are intentionally set

Re: missing indexes in indexlist with partitioned tables

2022-10-02 Thread David Rowley
On Sun, 2 Oct 2022 at 05:34, Arne Roland wrote: > > On Tue, Sep 20, 2022 at 4:53 PM David Rowley wrote: > > Arne sent me an off-list > > message to say he's planning on working on the patch that uses the > > existing field instead of the new one he originally added. Let's hold > > off for that

Re: missing indexes in indexlist with partitioned tables

2022-10-01 Thread Arne Roland
On Tue, Sep 20, 2022 at 4:53 PM David Rowley wrote: > Arne sent me an off-list > message to say he's planning on working on the patch that uses the > existing field instead of the new one he originally added. Let's hold > off for that patch. I wouldn't say, I explicitly stated that. But I ended

Re: missing indexes in indexlist with partitioned tables

2022-09-20 Thread Amit Langote
On Tue, Sep 20, 2022 at 4:53 PM David Rowley wrote: > Thank you for having a look at the patch. > > On Tue, 20 Sept 2022 at 18:41, Amit Langote wrote: > > Agreed, though the patch's changes to tests does not seem to have to > > do with join removal? I don't really understand what the test

Re: missing indexes in indexlist with partitioned tables

2022-09-20 Thread David Rowley
Thank you for having a look at the patch. On Tue, 20 Sept 2022 at 18:41, Amit Langote wrote: > Agreed, though the patch's changes to tests does not seem to have to > do with join removal? I don't really understand what the test changes > are all about. I wonder why the patch doesn't instead

Re: missing indexes in indexlist with partitioned tables

2022-09-20 Thread Amit Langote
On Fri, Sep 16, 2022 at 1:08 PM David Rowley wrote: > On Wed, 3 Aug 2022 at 11:07, Arne Roland wrote: > > Attached a rebased version of the patch. > Firstly, I agree that we should fix the issue of join removals not > working with partitioned tables. Agreed, though the patch's changes to tests

Re: missing indexes in indexlist with partitioned tables

2022-09-18 Thread David Rowley
On Sun, 18 Sept 2022 at 07:00, Tom Lane wrote: > > Alvaro Herrera writes: > > After a bit of trawling through the archives, I found it here: > > https://www.postgresql.org/message-id/20180124162006.pmapfiznhgngwtjf%40alvherre.pgsql > > I think there was insufficient discussion and you're

Re: missing indexes in indexlist with partitioned tables

2022-09-17 Thread Tom Lane
Alvaro Herrera writes: > On 2022-Sep-16, David Rowley wrote: >> I kinda disagree with Alvaro's fix in 05fb5d661. I think indexlist is >> the place to store these details. That commit added the following >> comment: >> >> /* >> * Ignore partitioned indexes, since they are not usable for >> *

Re: missing indexes in indexlist with partitioned tables

2022-09-17 Thread Alvaro Herrera
On 2022-Sep-16, David Rowley wrote: > I kinda disagree with Alvaro's fix in 05fb5d661. I think indexlist is > the place to store these details. That commit added the following > comment: > > /* > * Ignore partitioned indexes, since they are not usable for > * queries. > */ > > But neither are

Re: missing indexes in indexlist with partitioned tables

2022-09-15 Thread David Rowley
On Wed, 3 Aug 2022 at 11:07, Arne Roland wrote: > Attached a rebased version of the patch. Firstly, I agree that we should fix the issue of join removals not working with partitioned tables. I had a quick look over this and the first thing that I thought was the same as what Amit mentioned in:

Re: missing indexes in indexlist with partitioned tables

2022-08-02 Thread Arne Roland
Hi! Attached a rebased version of the patch. Regards Arne From: Arne Roland Sent: Monday, January 31, 2022 19:14 To: Amit Langote Cc: Zhihong Yu; Alvaro Herrera; Julien Rouhaud; pgsql-hackers Subject: Re: missing indexes in indexlist with partitioned tables

Re: missing indexes in indexlist with partitioned tables

2022-01-31 Thread Arne Roland
Hi! From: Amit Langote Sent: Tuesday, January 25, 2022 09:04 Subject: Re: missing indexes in indexlist with partitioned tables > [...] > "partindexlist" really made me think about a list of "partial indexes" > for some reason. I think maybe "partedin

Re: missing indexes in indexlist with partitioned tables

2022-01-25 Thread Amit Langote
Hi, On Mon, Jan 24, 2022 at 9:30 PM Arne Roland wrote: > The comment at my end goes on: > > /* > * Don't add partitioned indexes to the indexlist, since they are > * not usable by the executor. If they are unique add them to the > * partindexlist instead, to use for further pruning. If they > *

Re: missing indexes in indexlist with partitioned tables

2022-01-24 Thread Arne Roland
Hi! > From: Zhihong Yu > Subject: Re: missing indexes in indexlist with partitioned tables > > Hi, > > - if (indexRelation->rd_rel->relkind == RELKIND_PARTITIONED_INDEX) > + if (inhparent && (!index->indisuniqu

Re: missing indexes in indexlist with partitioned tables

2022-01-19 Thread Alvaro Herrera
On 2022-Jan-19, Arne Roland wrote: > > a) make sure that the submitted patch updates these test results so > > that the test pass [...] > > Just for the record: I did run the tests, but I did miss that the > commit of Tomas fix for fractional optimization is already on the > master. Please note

Re: missing indexes in indexlist with partitioned tables

2022-01-19 Thread Zhihong Yu
Sent:* Wednesday, January 19, 2022 10:13:55 PM > *To:* Alvaro Herrera; Julien Rouhaud > *Cc:* pgsql-hackers > *Subject:* Re: missing indexes in indexlist with partitioned tables > > > Hi! > > > From: Alvaro Herrera > > [...] > > Hmm, these plan cha

Re: missing indexes in indexlist with partitioned tables

2022-01-19 Thread Arne Roland
added it for potential future clarity. Thanks for your feedback again! Regards Arne From: Arne Roland Sent: Wednesday, January 19, 2022 10:13:55 PM To: Alvaro Herrera; Julien Rouhaud Cc: pgsql-hackers Subject: Re: missing indexes in indexlist with partitioned

Re: missing indexes in indexlist with partitioned tables

2022-01-19 Thread Arne Roland
Hi! > From: Alvaro Herrera > [...] > Hmm, these plan changes look valid to me. A left self-join using the > primary key column? That looks optimizable all right. > [...] > What I still don't know is whether this patch is actually desirable or > not. If the only cases it affects is self-joins,

Re: missing indexes in indexlist with partitioned tables

2022-01-18 Thread Alvaro Herrera
On 2022-Jan-18, Julien Rouhaud wrote: > SET enable_partitionwise_join = on; > EXPLAIN (COSTS OFF) > SELECT * FROM fract_t x LEFT JOIN fract_t y USING (id) ORDER BY id ASC LIMIT > 10; > - QUERY PLAN >

Re: missing indexes in indexlist with partitioned tables

2022-01-17 Thread Julien Rouhaud
Hi, On Mon, Jan 17, 2022 at 08:32:40PM +, Arne Roland wrote: > > Afaiac the join pruning where the outer table is a partitioned table is the > relevant case. The last version of the patch now fails on all platform, with plan changes. For instance:

Re: missing indexes in indexlist with partitioned tables

2022-01-17 Thread Arne Roland
: missing indexes in indexlist with partitioned tables Hmm, can you show cases of queries for which having this new partIndexlist changes plans? -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Saca el libro que tu religión considere como el indicado para encontr

Re: missing indexes in indexlist with partitioned tables

2022-01-17 Thread Alvaro Herrera
Hmm, can you show cases of queries for which having this new partIndexlist changes plans? -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Saca el libro que tu religión considere como el indicado para encontrar la oración que traiga paz a tu alma. Luego rebootea

Re: missing indexes in indexlist with partitioned tables

2022-01-17 Thread Arne Roland
Using some valuable feedback from Zhihong Yu, I fixed a flipped negation error and updated the comments. Regards Arne From: Arne Roland Sent: Monday, January 17, 2022 12:25 To: Julien Rouhaud Cc: pgsql-hackers Subject: Re: missing indexes in indexlist

Re: missing indexes in indexlist with partitioned tables

2022-01-17 Thread Arne Roland
Hi, thank you for the heads up! Those files ended up accidentally in the dump from me running pg_indent. The file count was truly excessive, I should have noticed this sooner. I attached the patch without the excessive modifications. That should be way easier to read. Regards Arne diff

Re: missing indexes in indexlist with partitioned tables

2022-01-15 Thread Julien Rouhaud
Hi, On Thu, Oct 28, 2021 at 01:44:31PM +, Arne Roland wrote: > > The attached patch takes that route. I'd appreciate feedback! The cfbot reports that the patch doesn't apply anymore: http://cfbot.cputube.org/patch_36_3452.log === Applying patches on top of PostgreSQL commit ID

Re: missing indexes in indexlist with partitioned tables

2021-10-28 Thread Arne Roland
Hi, I stumbled across a few places that depend on the inheritance appends being applied at a later date, so I quickly abandoned that idea. I thought a bit about the indexlist, in particular the inhparent, and I am not sure what depends on get_relation_info working in that way. Therefore I

missing indexes in indexlist with partitioned tables

2021-09-23 Thread Arne Roland
Hi, I did a bit of testing today and noticed that we don't set indexlist properly at the right time in some cases when using partitioned tables. I attached a simple case where the indexlist doesn't seems to be set at the right time. get_relation_info in plancat.c seems to process it only