| From: | "Jinyu Zhang" <beijing_pg(at)163(dot)com> |
|---|---|
| To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | BRIN Scan: Optimize memory allocation in function 'bringetbitmap' |
| Date: | 2015-09-27 07:15:13 |
| Message-ID: | 716fe8fb.4102.1500da7d084.Coremail.beijing_pg@163.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
BRIN Scan: Optimize memory allocation in function 'bringetbitmap'.
We can allocate memory for some pointer before do long loop instead of allocating
memory in long loop.
Before optimizing code (warm run)
postgres=# select count(*) from lineitem where l_orderkey=1;
count
-------
6
(1 row)
Time: 456.219 ms
After optimizing code (warm run)
postgres=# select count(*) from lineitem where l_orderkey=1;
count
-------
6
(1 row)
Time: 349.219 ms
The following shows the DDL of this test case.
CREATE TABLE LINEITEM ( L_ORDERKEY INTEGER NOT NULL,
L_PARTKEY INTEGER NOT NULL,
L_SUPPKEY INTEGER NOT NULL,
L_LINENUMBER INTEGER NOT NULL,
L_QUANTITY DECIMAL(15,2) NOT NULL,
L_EXTENDEDPRICE DECIMAL(15,2) NOT NULL,
L_DISCOUNT DECIMAL(15,2) NOT NULL,
L_TAX DECIMAL(15,2) NOT NULL,
L_RETURNFLAG CHAR(1) NOT NULL,
L_LINESTATUS CHAR(1) NOT NULL,
L_SHIPDATE DATE NOT NULL,
L_COMMITDATE DATE NOT NULL,
L_RECEIPTDATE DATE NOT NULL,
L_SHIPINSTRUCT CHAR(25) NOT NULL,
L_SHIPMODE CHAR(10) NOT NULL,
L_COMMENT VARCHAR(44) NOT NULL);
copy lineitem from '/home/jinyu/mywork/dbgen/lineitem.tbl' delimiter '|';
create index brinLineitem on lineitem using brin(L_ORDERKEY) with(pages_per_range = 1);
Jinyu Zhang
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jinyu Zhang | 2015-09-27 07:20:31 | Patch: Optimize memory allocation in function 'bringetbitmap' |
| Previous Message | Pavel Stehule | 2015-09-27 06:05:18 | Re: On-demand running query plans using auto_explain and signals |