Improvement of search for a binary operator

From: Atsushi Ogawa <a_ogawa(at)hi-ho(dot)ne(dot)jp>
To: pgsql-patches(at)postgresql(dot)org
Subject: Improvement of search for a binary operator
Date: 2006-04-27 12:27:54
Message-ID: 4450B8CA.8070704@hi-ho.ne.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Here is a gprof result of the pgbench.

% cumulative self self total
time seconds seconds calls s/call s/call name
4.77 4.04 4.04 14000 0.00 0.00 OpernameGetCandidates
4.70 8.02 3.98 2007008 0.00 0.00
HeapTupleSatisfiesSnapshot
4.50 11.83 3.81 14001 0.00 0.00 base_yyparse
3.78 15.03 3.20 2838312 0.00 0.00 AllocSetAlloc
3.73 18.18 3.15 40001 0.00 0.00 heapgetpage

The OpernameGetCandidates called from oper. The function of oper is
search for a binary operator. It does the following processing:

(1)Create candidates of operator that matches operator name and
operator kind by OpernameGetCandidates.
(2)Find an operator that matches exactly ltypeId and rtypeId from
the candidates of operator by binary_oper_exact.
(3)If not found, find an operator from the candidates of operator by
oper_select_candidate. The oper_select_candidate accepts coerce type
and resolve the conflict.

I think that we can search the system catalog cache instead of
retrieval from the candidates of operator in the binary_oper_exact,
and reverse the order of executing (1) and (2) for performance
improvement. Because for a general operator such as '=', the number
of the candidates of operator exceeds 50. And in common cases the
typeIds matches exactly.

I tested following commands:

pgbench -i
pgbench -t 4000 (5 times)

results (tps):
1 2 3 4 5 average
-----------------------------------------------------------
original: 214.33 184.60 192.52 158.62 170.04 184.02
patched : 223.86 198.72 207.48 165.70 179.67 195.09

regards,

---
Atsushi Ogawa

Attachment Content-Type Size
oper.patch text/plain 5.6 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2006-04-27 14:12:12 Re: be-secure.c patch
Previous Message Zeugswetter Andreas DCP SD 2006-04-27 09:45:48 Re: ANSI-strict pointer aliasing rules