Loading...

Partition Table In PostgreSQL (Simulate Millions Data)

PartitionTableInPostgreSQL(SimulateMillionsData)Part2

Bymkyong|July2,2008|Updated:May31,2010|Viewed:9,319|+6pv/w

IfyoudonotknowhowtodotablepartitioninPostgreSQL,pleasestudyPartitionTableInPostgreSQL(CreatePartition)Part1

Hereiwillprovideasimplefunctiontodemonstratehowtoinsertmillionofdataintopartitiontable。

–createsequencefortesting

CREATESEQUENCEhashvalue_PT_serialSTART1;

–GenerateDynamicdatafortesting

CREATEORREPLACEFUNCTIONhashvalue_PT_InsertRandomRecords(ina_no_of_recordsinteger)RETURNSintegerAS$$

DECLARE

v_counterinteger;

vhashvarchar(255);

v_datevarchar(15);

BEGIN

v_counter:=1;

RAISENOTICE’Noofrecordsinsert:%’,a_no_of_records;

WHILE(v_counter

Icreatedasimplehashvalue_PT_InsertRandomRecordsfunctiontosimulatedataforperformancetestingonpartitiontable。

select*fromhashvalue_PT_InsertRandomRecords(20000000);

Haha。

oneshotinsert200millionsdata。

Ok,nowihave200millionsofdatain10months,nextsessioniwillstarttodosomeperformancetestingbetweenpartitionandnon-partitiontable,pleasevisitPerformanceTestingonPartitionTableInPostgreSQLPart3


bckbet官网手机版下载_bck体育客服_bckbet体育官网地址