Re: overhead of expression evaluation

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: overhead of expression evaluation
Date: 2018-05-17 10:16:26
Message-ID: CAFj8pRBcBFVZNgkB0L31_=W-EVbZBPxjxc+dERo0mZQE3t9cVA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2018-05-17 11:32 GMT+02:00 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:

> Hi
>
> just for curiosity - I tested simple script
>
> postgres=# do
> $$
> declare s bigint = 0;
> begin
> for i in 1..1000000000 loop
> s := s + i;
> end loop;
> raise notice '%', s;
> end;
> $$;
>
> to see a overhead of some components
>
> 5,72% plpgsql.so [.] exec_assign_value
> 5,59% postgres [.] GetSnapshotData
> 4,94% plpgsql.so [.] exec_eval_simple_expr
> 4,84% postgres [.] AllocSetAlloc
> 3,61% postgres [.]
> ResourceOwnerForgetPlanCacheRef
> 2,95% postgres [.] choose_custom_plan
> 2,94% postgres [.] GetUserId
> 2,92% postgres [.] GetCachedPlan
> 2,87% postgres [.] LWLockAttemptLock
> 2,85% postgres [.] memset(at)plt
> 2,76% postgres [.] LWLockRelease
> 2,70% postgres [.] AllocSetFree
> 2,42% plpgsql.so [.] assign_simple_var
> 2,36% postgres [.] ExecInterpExpr
> 2,35% postgres [.] PopActiveSnapshot
> 2,27% postgres [.]
> OverrideSearchPathMatchesCurrent
> 2,22% plpgsql.so [.]
> plpgsql_param_eval_var
> 2,21% plpgsql.so [.] exec_stmt
> 1,89% libc-2.27.so [.]
> __memset_sse2_unaligned_erms
> 1,75% postgres [.] PushActiveSnapshot
> 1,74% postgres [.] AcquireExecutorLocks
> 1,67% postgres [.] CopySnapshot
> 1,64% postgres [.] CheckCachedPlan
> 1,56% postgres [.] RevalidateCachedQuery
> 1,55% postgres [.] MemoryContextAlloc
> 1,53% postgres [.] pfree
> 1,50% postgres [.] ResourceArrayRemove
> 1,43% postgres [.] LWLockAcquire
> 1,40% postgres [.]
> SPI_plan_get_cached_plan
>
>
maybe we need some new kind of function, that doesn't requires snapshots,
user info, locks - and the plan can be stored directly instead using plan
cache.

Hard to believe, what necessary be done before we want to calculate two
numbers.

Regards

Pavel

> Regards
>
> Pavel
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Arseny Sher 2018-05-17 10:54:07 Re: Possible bug in logical replication.
Previous Message Huong Dangminh 2018-05-17 09:51:31 RE: NaNs in numeric_power (was Re: Postgres 11 release notes)