public inbox for [email protected]  
help / color / mirror / Atom feed
[PATCH 2/3] Allow composite types in bootstrap
2+ messages / 2 participants
[nested] [flat]

* [PATCH 2/3] Allow composite types in bootstrap
@ 2020-11-17 15:28  Justin Pryzby <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Justin Pryzby @ 2020-11-17 15:28 UTC (permalink / raw)

---
 src/backend/bootstrap/bootstrap.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 18eb62ca47..e4fc75ab84 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -916,6 +916,7 @@ gettype(char *type)
 {
 	if (Typ != NIL)
 	{
+		static bool did_reread PG_USED_FOR_ASSERTS_ONLY = false; /* Already reread pg_types */
 		ListCell *lc;
 
 		foreach (lc, Typ)
@@ -927,6 +928,33 @@ gettype(char *type)
 				return app->am_oid;
 			}
 		}
+
+		/*
+		 * The type wasn't known; check again to handle composite
+		 * types, added since first populating the array.
+		 */
+
+		/*
+		 * Once all the types are populated and we handled composite
+		 * types, shouldn't need to do that again.
+		 */
+		Assert(!did_reread);
+		did_reread = true;
+
+		list_free_deep(Typ);
+		Typ = NULL;
+		populate_typ_array();
+
+		/* Need to avoid infinite recursion... */
+		foreach (lc, Typ)
+		{
+			struct typmap *app = lfirst(lc);
+			if (strncmp(NameStr(app->am_typ.typname), type, NAMEDATALEN) == 0)
+			{
+				Ap = app;
+				return app->am_oid;
+			}
+		}
 	}
 	else
 	{
-- 
2.26.2


--------------8FD28E9B65A94BB176003065
Content-Type: text/x-patch; charset=UTF-8;
 name="0003-Extended-statistics-on-expressions-20210116.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0003-Extended-statistics-on-expressions-20210116.patch"



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: COPY performance on Windows
@ 2024-11-05 14:53  Aleksander Alekseev <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Aleksander Alekseev @ 2024-11-05 14:53 UTC (permalink / raw)
  To: Ryohei Takahashi (Fujitsu) <[email protected]>; +Cc: [email protected] <[email protected]>

Hi Ryohei,

Thanks for the patch. Here are my two cents.

> I noticed that the COPY performance on PG 17.0 Windows is worse than PG 16.4.
>
>  [...]
>
> By applying the attached patch to PG 17.0, the copy result is 401.5s.

So we are trading a potential 3.8% speedup in certain environments for
the increased code complexity due to a couple of added #ifdef's here.

If we really want to do this, firstly the patch should have detailed
comments in front of #ifdefs so that in 10+ years from now someone who
didn't read this thread would know what they are for.

Secondly, more detailed research should be made on how this patch
affects the performance on Windows depending on the software version
and particular choice of hardware. Perhaps what you found is not the
only and/or the most important bottleneck. Your patch may (or may not)
cause performance degradation in other setups.

Last but not least one should double check that this will not cause
performance degradation on *nix systems.

To be honest, personally I wouldn't bother because of 3.8% speedup at
best (for 10+% - maybe). This being said perhaps you and other people
on the mailing list (reviewers, committers) feel otherwise.

-- 
Best regards,
Aleksander Alekseev






^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-11-05 14:53 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17 15:28 [PATCH 2/3] Allow composite types in bootstrap Justin Pryzby <[email protected]>
2024-11-05 14:53 Re: COPY performance on Windows Aleksander Alekseev <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox