Re: Avoid overhead open-close indexes (catalog updates)

2022-11-16 Thread Ranier Vilela
Em qua., 16 de nov. de 2022 às 04:23, Michael Paquier escreveu: > On Wed, Nov 16, 2022 at 06:58:01AM +0900, Michael Paquier wrote: > > This one has been left out on purpose. I was tempting to use > > WithInfo() with a CatalogIndexState opened optionally but I got the > > impression that it

Re: Avoid overhead open-close indexes (catalog updates)

2022-11-15 Thread Michael Paquier
On Wed, Nov 16, 2022 at 06:58:01AM +0900, Michael Paquier wrote: > This one has been left out on purpose. I was tempting to use > WithInfo() with a CatalogIndexState opened optionally but I got the > impression that it makes the code a bit harder to follow and > AddRoleMems() is already complex

Re: Avoid overhead open-close indexes (catalog updates)

2022-11-15 Thread Michael Paquier
On Tue, Nov 15, 2022 at 11:42:34AM -0300, Ranier Vilela wrote: > I find it very difficult not to have some tuple to be updated, > once inside CopyStatistics and the branch cost can get in the way, > but I don't object with your solution. The code assumes that it is a possibility. > Missed

Re: Avoid overhead open-close indexes (catalog updates)

2022-11-15 Thread Ranier Vilela
Em ter., 15 de nov. de 2022 às 04:02, Michael Paquier escreveu: > On Tue, Nov 15, 2022 at 09:57:26AM +0900, Michael Paquier wrote: > > Anyway, multi-inserts are going to be solution better than > > CatalogTupleInsertWithInfo() in some cases, because we would just > > generate one WAL record of N

Re: Avoid overhead open-close indexes (catalog updates)

2022-11-14 Thread Michael Paquier
On Tue, Nov 15, 2022 at 09:57:26AM +0900, Michael Paquier wrote: > Anyway, multi-inserts are going to be solution better than > CatalogTupleInsertWithInfo() in some cases, because we would just > generate one WAL record of N inserts rather than N records with one > INSERT each. Something that you

Re: Avoid overhead open-close indexes (catalog updates)

2022-11-14 Thread Michael Paquier
On Sat, Nov 12, 2022 at 11:03:46AM -0300, Ranier Vilela wrote: > I think complexity doesn't pay off. > For example, CopyStatistics not knowing how many tuples will be processed. > IMHO, this step is right now. > CatalogTupleInsertWithInfo offers considerable improvement without > introducing bugs

Re: Avoid overhead open-close indexes (catalog updates)

2022-11-12 Thread Ranier Vilela
Em sex., 11 de nov. de 2022 às 01:54, Michael Paquier escreveu: > On Thu, Nov 10, 2022 at 08:56:25AM -0300, Ranier Vilela wrote: > > For CopyStatistics() have performance checks. > > You are not giving all the details of your tests, though, Windows 10 64 bits SSD 256 GB pgbench -i

Re: Avoid overhead open-close indexes (catalog updates)

2022-11-10 Thread Michael Paquier
On Thu, Nov 10, 2022 at 08:56:25AM -0300, Ranier Vilela wrote: > For CopyStatistics() have performance checks. You are not giving all the details of your tests, though, so I had a look with some of my stuff using the attached set of SQL functions (create_function.sql) to create a bunch of indexes

Re: Avoid overhead open-close indexes (catalog updates)

2022-11-10 Thread Ranier Vilela
Em qui., 10 de nov. de 2022 às 05:16, Michael Paquier escreveu: > On Thu, Sep 01, 2022 at 08:42:15AM -0300, Ranier Vilela wrote: > > Let's wait for the patch to be accepted and committed, so we can try to > > change it. > > FWIW, I think that this switch is a good idea for cases where we >

Re: Avoid overhead open-close indexes (catalog updates)

2022-11-10 Thread Michael Paquier
On Thu, Sep 01, 2022 at 08:42:15AM -0300, Ranier Vilela wrote: > Let's wait for the patch to be accepted and committed, so we can try to > change it. FWIW, I think that this switch is a good idea for cases where we potentially update a bunch of tuples, especially based on what

Re: Avoid overhead open-close indexes (catalog updates)

2022-09-01 Thread Ranier Vilela
Em qua., 31 de ago. de 2022 às 22:12, Kyotaro Horiguchi < horikyota@gmail.com> escreveu: > At Wed, 31 Aug 2022 08:16:55 -0300, Ranier Vilela > wrote in > > Hi, > > > > The commit > > > https://github.com/postgres/postgres/commit/b17ff07aa3eb142d2cde2ea00e4a4e8f63686f96 > > Introduced the

Re: Avoid overhead open-close indexes (catalog updates)

2022-08-31 Thread Kyotaro Horiguchi
At Wed, 31 Aug 2022 08:16:55 -0300, Ranier Vilela wrote in > Hi, > > The commit > https://github.com/postgres/postgres/commit/b17ff07aa3eb142d2cde2ea00e4a4e8f63686f96 > Introduced the CopyStatistics function. > > To do the work, CopyStatistics uses a less efficient function > to update/insert

Avoid overhead open-close indexes (catalog updates)

2022-08-31 Thread Ranier Vilela
Hi, The commit https://github.com/postgres/postgres/commit/b17ff07aa3eb142d2cde2ea00e4a4e8f63686f96 Introduced the CopyStatistics function. To do the work, CopyStatistics uses a less efficient function to update/insert tuples at catalog systems. The comment at indexing.c says: "Avoid using it