Re: a pool for parallel worker

2025-03-25 Thread Andy Fan
Andy Fan writes: > Hi, >>> The boring thing for the pool is it is [dbid + userId] based, which >>> I mean if the dbid or userId is different with the connection in pool, >>> they can't be reused. To reduce the effect of UserId, I think if we can >>&

Re: a pool for parallel worker

2025-03-25 Thread Andy Fan
(b). Is there any other ways to allow different user with the same database sharing the same connection? Current "SET ROLE x" is exciting but "RESET SESSION AUTHORIZATION" is dispointing. -- Best Regards Andy Fan

Re: a pool for parallel worker

2025-03-24 Thread Andy Fan
Hi, > On Tue, Mar 11, 2025 at 5:39 AM Andy Fan wrote: >> Currently when a query needs some parallel workers, postmaster spawns >> some backend for this query and when the work is done, the backend >> exit. there are some wastage here, e.g. syscache, relcache, smgr cache,

Re: Bypassing cursors in postgres_fdw to enable parallel plans

2025-03-12 Thread Andy Fan
gt;already_executed || numberTuples != 0) use_parallel_mode = false; Actually I can't understand the comment as well and I had this confusion for a long time. -- Best Regards Andy Fan

a pool for parallel worker

2025-03-11 Thread Andy Fan
connection in pool, they can't be reused. To reduce the effect of UserId, I think if we can start the pool with a superuser and then switch the user information with 'SET ROLE xxx'. and the pool can be created lazily. Any comments on this idea? -- Best Regards Andy Fan

Re: Send multiple statements to pg server at once

2025-03-11 Thread Andy Fan
Pavel Stehule writes: > > If I remember well, you can use \; for this case > > https://www.postgresql.org/docs/current/app-psql.html > > Regards Thank you Pavel, it works! This is so handy! -- Best Regards Andy Fan

Send multiple statements to pg server at once

2025-03-11 Thread Andy Fan
|| (scan_result == PSCAN_EOL && pset.singleline)) { -- Best Regards Andy Fan

Re: Why does exec_simple_query requires 2 snapshots

2025-02-19 Thread Andy Fan
Tom Lane writes: > Andy Fan writes: >> Tom Lane writes: >>> Many years ago, we committed a patch to do exactly that. We had >>> to back it out again because it broke too many real-world scenarios. >>> I'm too lazy to search the archives for you, but

Re: Why does exec_simple_query requires 2 snapshots

2025-02-18 Thread Andy Fan
Tom Lane writes: > Andy Fan writes: >> My question is why can't we share the same snapshot for the 2 cases? >> parser & planner requires Catalog Snapshot which should be the >> latest one, but in the above case, looks the executor can reuse it as >> well.

Why does exec_simple_query requires 2 snapshots

2025-02-18 Thread Andy Fan
? Thanks -- Best Regards Andy Fan

Re: Pre-allocating WAL files

2025-01-21 Thread Andy Fan
s me user can only fsync one file each time. int fsync(int fd); The fsync manual seems not saying fsync on a directory would fsync all the files under that directory. -- Best Regards Andy Fan

Re: Pre-allocating WAL files

2025-01-20 Thread Andy Fan
ocated yet. - we need to handle race condition carefully between wal_recycle, user backend and preallocation. [0] https://www.postgresql.org/message-id/Z46BwCNAEjLyW85Z%40nathan -- Best Regards Andy Fan

Re: Purpose of wal_init_zero

2025-01-20 Thread Andy Fan
I will go to [0] for further dicussion on this topic. > [0] https://postgr.es/m/20220408203003.GA1630183%40nathanxps13 -- Best Regards Andy Fan

Re: Purpose of wal_init_zero

2025-01-15 Thread Andy Fan
have a try if we can offload wal_init_zero to the walwriter. About the wal_recycle, IIUC, it can only recycle a wal file during Checkpoint, but checkpoint doesn't happens often. -- Best Regards Andy Fan

Purpose of wal_init_zero

2025-01-15 Thread Andy Fan
still unclear to me. I noticed this during a benchmark, where WALWriteLock is waited and the holder is running WAIT_EVENT_WAL_INIT_WRITE. -- Best Regards Andy Fan

Re: pgbench error: (setshell) of script 0; execution of meta-command failed

2025-01-09 Thread Andy Fan
Andy Fan writes: > Hi: > > I run into the {subject} issue with the below setup. > > cat foo.sql > > \setshell txn_mode echo ${TXN_MODE} > \setshell speed echo ${SPEED} > \setshell sleep_ms echo ${SLEEP_MS} > \setshell subtxn_mode echo ${SUBTXN_MODE} > >

pgbench error: (setshell) of script 0; execution of meta-command failed

2025-01-09 Thread Andy Fan
find anything useful, so I'd like have a ask if there is any known issue or the way I use \setshell is wrong? Thanks -- Best Regards Andy Fan

Re: testing framework for MVCC & vacuum (freeze) & heap_page_prune etc.

2024-12-09 Thread Andy Fan
"Andrey M. Borodin" writes: >> On 10 Dec 2024, at 08:31, Andy Fan wrote: >> >> I want to know if we have some existing testing framework for >> this area (design, code, licence etc). > > I think isolation tests [0] are what you are looking for. These

Re: testing framework for MVCC & vacuum (freeze) & heap_page_prune etc.

2024-12-09 Thread Andy Fan
Andy Fan writes: > Hi, > > I'm willing to design one myself > but it would be better have a ask first to see if there is some existing > excellent project I can start with and contribute to. Just to show that I'm not a person who taking things for granted, this is

testing framework for MVCC & vacuum (freeze) & heap_page_prune etc.

2024-12-09 Thread Andy Fan
sting excellent project I can start with and contribute to. Thanks! -- Best Regards Andy Fan

Re: postgres_fdw: Provide better emulation of READ COMMITTED behavior

2024-12-07 Thread Andy Fan
Etsuro Fujita writes: > On Fri, Dec 6, 2024 at 7:50 PM Andy Fan wrote: >> Apart from the above issue, what do you think about that we are using a >> 'SELECT pg_catalog.pg_refresh_snapshot()' to let the remote do the >> refresh_snapshot VS 'a new messag

Re: postgres_fdw: Provide better emulation of READ COMMITTED behavior

2024-12-06 Thread Andy Fan
#x27;a complete parser-planner-executor workflow.' With a new message type for this, we can send the message character with the next query together. if so, can the two overheads removed? -- Best Regards Andy Fan

Re: Code cleanup for detoast a expanded datum.

2024-12-01 Thread Andy Fan
Michel Pelletier writes: > On Mon, Nov 18, 2024 at 7:42 PM Andy Fan wrote: > > Andy Fan writes: > > > > > make check-world passed after applying this patch. > > v2 changes the places of Assert, which is missed in v1 by mistakes. > > I'm not an ex

Re: Code cleanup for detoast a expanded datum.

2024-11-18 Thread Andy Fan
Andy Fan writes: > > make check-world passed after applying this patch. v2 changes the places of Assert, which is missed in v1 by mistakes. -- Best Regards Andy Fan >From 0bbd242e034b8461e40bb17aec4fa354f5c97815 Mon Sep 17 00:00:00 2001 From: Andy Fan Date: Tue, 29 Oct 2024 14:05

Code cleanup for detoast a expanded datum.

2024-11-18 Thread Andy Fan
se a more specific code to handle this, see the attached patch. We already have lots of kind of toast type and some of checks have overlap, this cleanup should make people less confused when reading this code. make check-world passed after applying this patch. Any thought? -- Best Regards Andy

Re: Document for wal_log_hints

2024-11-18 Thread Andy Fan
Michael Paquier writes: > On Tue, Nov 19, 2024 at 09:03:57AM +0800, Andy Fan wrote: >> So if data checksums is enabled, nothing can be tested when turning >> wal_log_hints on/off. >> @@ -3319,7 +3319,7 @@ include_dir 'conf.d' >> If data checksums are

Document for wal_log_hints

2024-11-18 Thread Andy Fan
-- Best Regards Andy Fan >From f9925545a752475fce61caea942a0057106636e4 Mon Sep 17 00:00:00 2001 From: Andy Fan Date: Tue, 19 Nov 2024 08:58:22 +0800 Subject: [PATCH v1 1/1] doc: correct the method to test the impact of wal_log_hints. --- doc/src/sgml/config.sgml | 2 +- 1 file changed

Re: Extract numeric filed in JSONB more effectively

2024-11-17 Thread Andy Fan
Hi Dmitry, >> On Thu, Sep 12, 2024 at 03:03:18AM GMT, Andy Fan wrote: >> >> > I imagined you'd the patch should create a SupportRequestSimplify >> > support function for jsonb_numeric() that checks if the input >> > expression is an OpExpr with func

Re: explain plans for foreign servers

2024-11-11 Thread Andy Fan
oduce a new > message type in the protocol to send back explain plans but it might > look like too much work for this feature. Open to ideas here. This generally looks good to me. Looking forward a patch for the details. -- Best Regards Andy Fan

Re: Deleting older versions in unique indexes to avoid page splits

2024-11-07 Thread Andy Fan
Peter Geoghegan writes: > On Thu, Nov 7, 2024 at 7:38 PM Andy Fan wrote: >> If the delete goes with Index Scan of t_b_idx, we still have the chances >> to mark hints on t_b_idx, so that it can be useful during index split? > > The exact rules for when LP_DEAD bits are set

Re: Deleting older versions in unique indexes to avoid page splits

2024-11-07 Thread Andy Fan
Andy Fan writes: > (3). DELETE does generate new index entry, but we might not touch > the indexes at all during deletes (*except the index we used for index > scan*). I still not check the code right now (it may still take times for me even I understand the overall design). So do w

Re: Deleting older versions in unique indexes to avoid page splits

2024-11-07 Thread Andy Fan
Peter Geoghegan writes: Hi Peter, I think I understand the main idea now with your help, I'd like to repeat my understanding for your double check. > On Thu, Nov 7, 2024 at 3:05 AM Andy Fan wrote: >> So my questions are: (a) How does the "logically unchanged index"

Re: Deleting older versions in unique indexes to avoid page splits

2024-11-07 Thread Andy Fan
split?), then the IO-cost is paid anyway, do we still need the "logically unchanged index hint"? At last, appreciated for your effort on making this part much better! -- Best Regards Andy Fan

Re: New function normal_rand_array function to contrib/tablefunc.

2024-11-06 Thread Andy Fan
Aleksander, I can understand your kindly intention! If no new ideas, I will defer to Dean's final decision for efficient purpose. -- Best Regards Andy Fan

Re: New function normal_rand_array function to contrib/tablefunc.

2024-11-03 Thread Andy Fan
Dean Rasheed writes: > On Wed, 16 Oct 2024 at 08:43, Andy Fan wrote: >> >> Thanks for the detailed feedback! Here is the rebased version. >> > > I took another look at this and I think it's in reasonable shape. > > I'm attaching an update, rebasi

Re: Avoid detoast overhead when possible

2024-10-30 Thread Andy Fan
t doesn't seem worthy at first glance. Do you have any ideas on > this? I think the more important ones are (a) what the new storage looks like, (b) how does it works with the ExprExecutionEnginner. Without that infromation, I think it is too soon to talk about this. -- Best Regards Andy Fan

Re: Avoid detoast overhead when possible

2024-10-29 Thread Andy Fan
/message-id/CAN-LCVO3GZAKVTKNwwcezoc%3D9Lq%3DkU2via-BM3MXVdOq4tD9RQ%40mail.gmail.com -- Best Regards Andy Fan

Re: detoast datum into the given buffer as a optimization.

2024-10-29 Thread Andy Fan
can check [1] for a indepent improvements for this topic. [1] https://www.postgresql.org/message-id/874j4vcspl.fsf%40163.com -- Best Regards Andy Fan

Re: detoast datum into the given buffer as a optimization.

2024-10-29 Thread Andy Fan
detoast, but then there is no detailed design or code later, which makes me confused about the state of this direction. But if you want to talk about this, could we discuss on its own thread? Thanks -- Best Regards Andy Fan

Re: detoast datum into the given buffer as a optimization.

2024-10-28 Thread Andy Fan
ld' passed. -- Best Regards Andy Fan >From 7208142241ac18e44be2ee87e9c83c451032ca95 Mon Sep 17 00:00:00 2001 From: Andy Fan Date: Tue, 29 Oct 2024 14:05:05 +0800 Subject: [PATCH v20241029 1/1] Using more specific code when detoasting an expanded datum. In the detoast_attr function, VARATT_

Re: detoast datum into the given buffer as a optimization.

2024-10-28 Thread Andy Fan
Hi Tom, > Andy Fan writes: >> * Note if caller provides a non-NULL buffer, it is the duty of caller >> * to make sure it has enough room for the detoasted format (Usually >> * they can use toast_raw_datum_size to get the size) > > This is a pretty awful, unsaf

Re: Considering fractional paths in Append node

2024-10-28 Thread Andy Fan
as RelOptInfo's tuple_fraction. (b). We have used root->tuple_fraction in RelOptInfo in some cases and also tried to not use it in some other case (and only use it under some situation similar like what I did before). Looks different committers have different opinion on this. -- Best Regards Andy Fan

Re: -Wformat-signedness

2024-10-26 Thread Andy Fan
o, just that want some clean code:) But FWIW, "-Wformat-signedness" is not supported by clang so far, so if people is using clang, they still can't benefit from this changes. My soluation (I use clang everyday) is adding a "gcc-checker" for my c file, if I make such mistake, it can remind me directly. [0] https://www.postgresql.org/message-id/874j4yl4cj.fsf%40163.com [1] https://www.postgresql.org/message-id/CA%2BhUKGJNUk434tcsVbs5YUGsujZbveo43QcZeWbv0xPzg9us-A%40mail.gmail.com -- Best Regards Andy Fan

Re: New function normal_rand_array function to contrib/tablefunc.

2024-10-26 Thread Andy Fan
Dean Rasheed writes: > On Sat, 26 Oct 2024 at 01:51, Andy Fan wrote: >> >> > 10). In this error: >> > >> > +elog(ERROR, "unsupported type %d for rand_array function.", >> > + datatype); >> > >> > &q

Re: New function normal_rand_array function to contrib/tablefunc.

2024-10-25 Thread Andy Fan
t any warnings. clang -O0 -g main.c -o main -Wall -Wformat gcc -g main.c -o main -Wall -Wformat scan-build clang -g main.c -o main -Wall -Wformat cppcheck main.c clang: 18.1.6 gcc: 13.3.0 Only "cppcheck --enable=all main.c" catch the warnning. Any hints on this will be appreicated. -- Best Regards Andy Fan

Re: [PoC] Partition path cache

2024-10-24 Thread Andy Fan
e first partition?". If I were you, I might check all the used statistics on this stage and try to find out a similar algorithms to prove that the best path would be similar too. This can happens once when the statistics is gathered. However this might be not easy. -- Best Regards Andy Fan

Re: Considering fractional paths in Append node

2024-10-18 Thread Andy Fan
ww.postgresql.org/message-id/CAApHDvry0nSV62kAOH3iccvfPhGPLN0Q97%2B%3Db1RsDPXDz3%3DCiQ%40mail.gmail.com -- Best Regards Andy Fan

Re: Considering fractional paths in Append node

2024-10-17 Thread Andy Fan
enk1 t1 (cost=0.29..80.09 rows=1 width=8) Index Cond: (tenthous = t2.tenthous) -> Result (cost=0.00..0.01 rows=1 width=4) (8 rows) Looks we still have some other stuff to do, but we have seen the desired plan has a closer cost to estimated best plan than before. [1] https://www.postgresql.org/message-id/flat/3783591.1721327902%40sss.pgh.pa.us#09d6471fc59b35fa4aca939e49943c2c -- Best Regards Andy Fan

Re: Considering fractional paths in Append node

2024-10-17 Thread Andy Fan
ate_orderedappend_paths() when we have a valid LIMIT value. > I'm currently checking if it is working correctly in multiple cases, > so 'll send it after we deal with this issue. -- Best Regards Andy Fan

Re: MergeAppend could consider sorting cheapest child path

2024-10-16 Thread Andy Fan
ult, the leader just do the merge works. At the high level implementaion, sorting *cheapest* child path looks doesn't add too much overhead on the planning effort. -- Best Regards Andy Fan

Re: Considering fractional paths in Append node

2024-10-16 Thread Andy Fan
rel since root->tuple_fraction is on subquery level, while the add_paths_to_append_rel is only on RelOptInfo level. [1] https://www.postgresql.org/message-id/CAApHDvry0nSV62kAOH3iccvfPhGPLN0Q97%2B%3Db1RsDPXDz3%3DCiQ%40mail.gmail.com -- Best Regards Andy Fan

Re: New function normal_rand_array function to contrib/tablefunc.

2024-10-16 Thread Andy Fan
a Datum. Done. > > > 13). These new functions are significantly under-documented, > especially when compared to all the other functions on > https://www.postgresql.org/docs/current/tablefunc.html > > They really should have their own subsection, along the same lines as &g

Re: GetRelationPath() vs critical sections

2024-10-05 Thread Andy Fan
just realize I proposed to [change] the API rather than adding an new variant, that's not my intention and that's my fault). -- Best Regards Andy Fan

Re: FullTransactionIdAdvance question

2024-09-22 Thread Andy Fan
Hi Andres: > On 2024-09-20 17:38:40 +0800, Andy Fan wrote: >> static inline void >> FullTransactionIdAdvance(FullTransactionId *dest) >> { .. >> } >> >> I understand this functiona as: 'dest->value++' increases the epoch when >> necessar

FullTransactionIdAdvance question

2024-09-20 Thread Andy Fan
r than FirstNormalTransactionId looks strange as well. IIUC, should we remove it to save a prediction on each GetNewTransactionId call? -- Best Regards Andy Fan

Re: detoast datum into the given buffer as a optimization.

2024-09-18 Thread Andy Fan
Jubilee Young writes: > On Wed, Sep 18, 2024 at 2:23 PM Nathan Bossart > wrote: >> >> On Wed, Sep 18, 2024 at 05:35:56PM +0800, Andy Fan wrote: >> > Currently detoast_attr always detoast the data into a palloc-ed memory >> > and then if user wants the deto

Re: detoast datum into the given buffer as a optimization.

2024-09-18 Thread Andy Fan
Thank you all for the double check. > Andy Fan writes: >> * Note if caller provides a non-NULL buffer, it is the duty of caller >> * to make sure it has enough room for the detoasted format (Usually >> * they can use toast_raw_datum_size to get the size) > > ...

detoast datum into the given buffer as a optimization.

2024-09-18 Thread Andy Fan
om [3] https://www.postgresql.org/message-id/6718759c-2dac-48e4-bf18-282de4d82204%40enterprisedb.com -- Best Regards Andy Fan

Re: Make printtup a bit faster

2024-09-12 Thread Andy Fan
ose). so I want some of you can have a double check on these function bodies, if anything wrong, I can change it easlier (vs I made the same efforts on all the type function). does it make sense? Patch 0001 ~ 0003 is something related and can be reviewed or committed seperately. and 0004 is the main

Re: Extract numeric filed in JSONB more effectively

2024-09-11 Thread Andy Fan
,4,8}/float{4,8} in pg_proc for '->' operator, not only numeric. 2. user may use OpExpr, like (jb->'x')::numeric, user may also use FuncExpr, like (jsonb_object_field(a, 'x'))::numeric. -- Best Regards Andy Fan

Re: Make printtup a bit faster

2024-09-10 Thread Andy Fan
Hello David & Andreas, > On 8/29/24 1:51 PM, David Rowley wrote: >> I had planned to work on this for PG18, but I'd be happy for some >> assistance if you're willing. > > I am interested in working on this, unless Andy Fan wants to do this > work. :) I b

Re: Make printtup a bit faster

2024-09-01 Thread Andy Fan
Andy Fan writes: > The attached is PoC of this idea, not matter which method are adopted > (rewrite all the outfunction or a optional print function), I think the > benefit will be similar. In the blew test case, it shows us 10%+ > improvements. (0.134ms vs 0.110ms) After working o

Re: Make printtup a bit faster

2024-08-29 Thread Andy Fan
m back again for > output strings larger than L1. The attached is PoC of this idea, not matter which method are adopted (rewrite all the outfunction or a optional print function), I think the benefit will be similar. In the blew test case, it shows us 10%+ improvements. (0.134ms vs 0

Re: Make printtup a bit faster

2024-08-29 Thread Andy Fan
David Rowley writes: > On Fri, 30 Aug 2024 at 13:04, Andy Fan wrote: >> >> David Rowley writes: >> > If there's anywhere we call output functions >> > where the resulting value isn't directly appended to a StringInfo, >> > then we could j

Re: Make printtup a bit faster

2024-08-29 Thread Andy Fan
David Rowley writes: > On Fri, 30 Aug 2024 at 12:10, Andy Fan wrote: >> What would be the extra benefit we redesign all the out functions? > > If I've understood your proposal correctly, it sounds like you want to > invent a new "print" output function for each

Re: Make printtup a bit faster

2024-08-29 Thread Andy Fan
PG18, but I'd be happy for some > assistance if you're willing. I see you did many amazing work with cache-line-frindly data struct design, branch predition optimization and SIMD optimization. I'd like to try one myself. I'm not sure if I can meet the target, what if we handle the out/in function separately (can be by different people)? -- Best Regards Andy Fan

Make printtup a bit faster

2024-08-29 Thread Andy Fan
some infrastructure changes. the memcpy in step 4 is: "1.27% __memcpy_avx_unaligned_erms" in my above case. What do you think? -- Best Regards Andy Fan

Re: New function normal_rand_array function to contrib/tablefunc.

2024-08-28 Thread Andy Fan
Japin Li writes: > On Wed, 28 Aug 2024 at 12:27, Andy Fan wrote: >> Japin Li writes: >> > Nitpick, the minlen is smaller than maxlen, so the maxlen cannot be zero. > > After giving it some more thought, it would also be helpful if maxlen is > equal to minlen. > &

Re: Parallel CREATE INDEX for GIN indexes

2024-08-28 Thread Andy Fan
where the patch doesn't help otherwise). But then in other cases it > doesn't help at all, and 0010 helps. Yes, I'd like to see these improvements both 0008 and 0010 as a dedicated improvement. -- Best Regards Andy Fan

Re: New function normal_rand_array function to contrib/tablefunc.

2024-08-27 Thread Andy Fan
errmsg("minlen and maxlen must be greater than > zero."))); > > Here the minlen might be zero, so the error message is incorrect. > How about use "minlen must be greater than or equal to zero"? Yes, you are right. A new version is attached, thanks for

Re: Parallel CREATE INDEX for GIN indexes

2024-08-27 Thread Andy Fan
) we'll be able to see a meaningfully larger performance > improvement. Personally I am more fans of your "buffer writetup" idea, but not the same interests with the tuplesort_beginsortedrun / tuplesort_endsortedrun. I said the '3%' is for the later one and I guess you understand it as the former one. > >> So my option is if we can have agreement on 0008, then we can final >> review/test on the existing code (including 0009), and leave further >> improvement as a dedicated patch. > > As mentioned above, I think I could update the patch for a btree > implementation that also has immediate benefits, if so desired? If you are saying about the buffered-writetup in tuplesort, then I think it is great, and in a dedicated thread for better exposure. -- Best Regards Andy Fan

Re: Parallel CREATE INDEX for GIN indexes

2024-08-27 Thread Andy Fan
-sort tuples into tape directly rather than inserting them into tuplesort's memory and dump them into tape without a sort. However I can't define a clean API for the former case. c). create-index is a maintenance work, improving it by 30% would be good, but if we just improve it by <3, it looks not very charming in practice. So my option is if we can have agreement on 0008, then we can final review/test on the existing code (including 0009), and leave further improvement as a dedicated patch. What do you think? [1] https://www.postgresql.org/message-id/87le0iqrsu.fsf%40163.com -- Best Regards Andy Fan

Re: New function normal_rand_array function to contrib/tablefunc.

2024-08-27 Thread Andy Fan
Andy Fan writes: >>> My suggestion would be to mirror the signatures of the core random() >>> functions more closely, and have this: >>> >>> 1). rand_array(numvals int, minlen int, maxlen int) >>> returns setof float8[] >>> > .

Re: New function normal_rand_array function to contrib/tablefunc.

2024-08-26 Thread Andy Fan
gestion in the new attached version. They are not only some cleaner APIs for user and but also some cleaner implementation in core, Thank for this suggestion as well. Sorry for the late response, just my new posistion is bit of busy that I don't have enough time on community work. -- Best Regards

Measure the servers's IO performance

2024-08-21 Thread Andy Fan
thers. pg_read_binary_file is better, but file system cache still there. should we expose a direct-io option for pg_read_binary_file? -- Best Regards Andy Fan

Re: Seq scan instead of index scan querying single row from primary key on large table

2024-07-30 Thread Andy Fan
tartup_cost in cost_seqscan, I must be wrong now, but I want to know where is it. > and I'm far from sure that it would not have any negative > side-effects. Yes, I think it is a semantics correct than before however. -- Best Regards Andy Fan

Re: Comment in portal.h

2024-07-30 Thread Andy Fan
les for a held cursor or a PORTAL_ONE_RETURNING, > PORTAL_ONE_MOD_WITH, or PORTAL_UTIL_SELECT query.". Attached is a > patch for that. Patch looks good to me. All the codes of PortalRun & FillPortalStore & PortalRunSelect are consistent with this idea. -- Best Regards Andy Fan

Re: Optimize WindowAgg's use of tuplestores

2024-07-18 Thread Andy Fan
key' change can cause noticeable change, especially there is just one function call in the 'if-statement' (I am thinking more instrucments in the if-statement body, more changes it can cause). + if (unlikely(winstate->buffer == NULL)) + prepare_tuplestore(winstate); -- Best Regards Andy Fan

Re: New function normal_rand_array function to contrib/tablefunc.

2024-07-16 Thread Andy Fan
Andy Fan writes: (just noticed this reply is sent to Jim privately, re-sent it to public.) > Hi Jim, > >> >> When either minval or maxval exceeds int4 the function cannot be >> executed/found >> >> SELECT * FROM normal_rand_array(5, 10, 8, 42::bigint); >

Re: New function normal_rand_array function to contrib/tablefunc.

2024-07-16 Thread Andy Fan
is doing. OK, you are right, your new names should be better. > Also, the function accepts float8 minval and maxval arguments, and > then simply ignores them and returns random float8 values in the range > [0,1), which is highly counterintuitive. This is a obvious bug and it only exists in float8 case IIUC, will fix it in the next version. -- Best Regards Andy Fan

Re: Parallel CREATE INDEX for GIN indexes

2024-07-08 Thread Andy Fan
Andy Fan writes: I just realize all my replies is replied to sender only recently, probably because I upgraded the email cient and the short-cut changed sliently, resent the lastest one only >>> Suppose RBTree's output is: >>> >>> batch-1 at RBTree: &

Re: Make tuple deformation faster

2024-07-01 Thread Andy Fan
d of CPUs. a). Intel Xeon Processor (Icelake) for my ECS b). Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz at Mac. My ECS reports " branch-misses", probabaly because it runs in virtualization software , and Mac doesn't support perf yet :( -- Best Regards Andy Fan

Re: Parallel CREATE INDEX for GIN indexes

2024-07-01 Thread Andy Fan
find anything wrong in the currrent patch, and the above stuff can be categoried into "furture improvement" even it is worthy to. -- Best Regards Andy Fan >From 48c2e03fd854c8f88f781adc944f37b004db0721 Mon Sep 17 00:00:00 2001 From: Andy Fan Date: Sat, 8 Jun 2024 13:21:08 +080

Re: Make tuple deformation faster

2024-07-01 Thread Andy Fan
much it can improve in an ideal case, is it possible to forecast it somehow? I ask it here because both cases are optimizing for CPU cache.. -- Best Regards Andy Fan

Re: Question about maxTapes & selectnewtape & dumptuples

2024-06-30 Thread Andy Fan
Heikki Linnakangas writes: > On 30/06/2024 12:48, Andy Fan wrote: >> for example, at the first use of outputTapes[x], it stores (1, 3, 5, >> 7), >> and later (2, 4, 6, 8) are put into it. so the overall of (1, 3, 5, 7, >> 2, 4, 6, 8) are not sorted? Where di

Question about maxTapes & selectnewtape & dumptuples

2024-06-30 Thread Andy Fan
the first use of outputTapes[x], it stores (1, 3, 5, 7), and later (2, 4, 6, 8) are put into it. so the overall of (1, 3, 5, 7, 2, 4, 6, 8) are not sorted? Where did I go wrong? -- Best Regards Andy Fan

Re: cost delay brainstorming

2024-06-25 Thread Andy Fan
Andy Fan writes: > >> - Longrunning transaction prevents increasing relfrozenxid, we run autovacuum >> over and over on the same relation, using up the whole cost budget. This is >> particularly bad because often we'll not autovacuum anything else, building &

Re: cost delay brainstorming

2024-06-21 Thread Andy Fan
les > having been cleaned up by on-access pruning. Good to know this case. if we update the pg_stats_xx metrics when on-access pruning, would it is helpful on this? > - Larger tables with occasional lock conflicts cause autovacuum to be > cancelled and restarting from scratch over and over. If that happens before > the second table scan, this can easily eat up the whole cost budget without > making forward progress. Off-peak time + manual vacuum should be helpful I think. -- Best Regards Andy Fan

Re: Shared detoast Datum proposal

2024-06-21 Thread Andy Fan
Andres doesn't have such time so far:( > Robert Haas writes: > >> On Wed, May 22, 2024 at 9:46 PM Andy Fan wrote: >>> Please give me one more chance to explain this. What I mean is: >>> >>> Take SELECT f(a) FROM t1 join t2...; for example, >>>

configure error when CFLAGS='-Wall -Werror

2024-06-20 Thread Andy Fan
t support '-qlanglvl' all the time, why removing the CFLAGS matters. 2. If you are using clang as well, what CFLAGS you use and it works? for example: IIRC, clang doesn't report error when a variable is set but no used by default, we have to add some extra flags to make it. -- Best Regards Andy Fan

New function normal_rand_array function to contrib/tablefunc.

2024-06-07 Thread Andy Fan
5 means it needs to produce 5 rows in total and the 10 is the average array length, and 1.8 is the minvalue for the random function and 3.5 is the maxvalue. -- Best Regards Andy Fan >From 397dcaf67f29057b80aebbb6116b49ac8344547c Mon Sep 17 00:00:00 2001 From: Andy Fan Date: Sat, 8 Jun 2024

differential test coverage when working on a patch

2024-06-03 Thread Andy Fan
ov at [1] and the options like '--diff-file' or '--select-script' looks very promising, but all of them needs some time to try it out and then automate it. so I'd like to ask first.. [1] https://github.com/linux-test-project/lcov/blob/master/README -- Best Regards Andy Fan

Re: why memoize is not used for correlated subquery

2024-05-28 Thread Andy Fan
e big improvement for planning a big number of partitioned table. -- Best Regards Andy Fan

Re: Parallel CREATE INDEX for GIN indexes

2024-05-28 Thread Andy Fan
d enough for its purpose? If so, we can save the memory for OffsetNumber for each GinTuple. Item 5) and 6) needs some coding and testing. If it is OK to do, I'd like to take it as an exercise in this area. (also including the item 1~4.) -- Best Regards Andy Fan

Re: Shared detoast Datum proposal

2024-05-23 Thread Andy Fan
Robert Haas writes: > On Wed, May 22, 2024 at 9:46 PM Andy Fan wrote: >> Please give me one more chance to explain this. What I mean is: >> >> Take SELECT f(a) FROM t1 join t2...; for example, >> >> When we read the Datum of a Var, we read it from tts->tts_

Re: using extended statistics to improve join estimates

2024-05-22 Thread Andy Fan
Andrei Lepikhov writes: > On 20/5/2024 15:52, Andy Fan wrote: >> Hi Andrei, >> >>> On 4/3/24 01:22, Tomas Vondra wrote: >>>> Cool! There's obviously no chance to get this into v18, and I have stuff >>>> to do in this CF. But I'll take

Re: Shared detoast Datum proposal

2024-05-22 Thread Andy Fan
Nikita Malakhov writes: > Hi, > Andy, glad you've not lost interest in this work, I'm looking > forward to your improvements! Thanks for your words, I've adjusted to the rhythm of the community and welcome more feedback:) -- Best Regards Andy Fan

Re: Shared detoast Datum proposal

2024-05-22 Thread Andy Fan
Robert Haas writes: > On Tue, May 21, 2024 at 10:02 PM Andy Fan wrote: >> One more things I want to highlight it "syscache" is used for metadata >> and *detoast cache* is used for user data. user data is more >> likely bigger than metadata, so cache size contr

Re: Shared detoast Datum proposal

2024-05-21 Thread Andy Fan
Andy Fan writes: > Hi Robert, > >> Andy Fan asked me off-list for some feedback about this proposal. I >> have hesitated to comment on it for lack of having studied the matter >> in any detail, but since I've been asked for my input, here goes: > > Thank

Re: Shared detoast Datum proposal

2024-05-21 Thread Andy Fan
Hi Robert, > Andy Fan asked me off-list for some feedback about this proposal. I > have hesitated to comment on it for lack of having studied the matter > in any detail, but since I've been asked for my input, here goes: Thanks for doing this! Since we have two totally dif

  1   2   3   4   5   6   7   >