Ñäåëàë ïàò÷ äëÿ èñïîëüçîâàíèÿ â òðàíêå sequence:
Ñîçäàíèå sequence â ñëó÷àå åñëè ñåðâåð íîâûé:
â ñëó÷àå åñëè óæå ðàáîòàë:
ïîëó÷àåì ñïèñîê çàïðîñîâ íà ñîçäàíèå sequence è âûïîëíÿåì èõ.
è íåïîñðåäñòâåííî ïàò÷ â àòà÷å.
Áîëüøàÿ ïðîñüáà îáðàòèòü âíèìàíèå íà íåãî ðàçðàáîò÷èêàì. Èç-çà ñëèøêîì ÷àñòûõ UPDATE ids âîçíèêàþò concurrency
èç-çà ýòîãî áûâàþò ïðîöåññû îæèäàþò.
Äîïîëíèòåëüíî íóæíî ïðîäóìàòü ñáðîñ sequence, íî äóìàþ íàâðÿäëå ïîíàäîáèòñÿ, ò.ê. max value î÷åíü áîëüøîé)
ÇÛ: ìèíóñ ïàò÷à, ò.ê. îæèäàíèå ïðîöåññàìè óìåíüøåíî, òî çàïðîñîâ â ñåêóíäó áîëüøå è íàãðóçêà íà ïðîöåññîð òîæå áîëüøå
Ñîçäàíèå sequence â ñëó÷àå åñëè ñåðâåð íîâûé:
Code:
create sequence acknowledges_acknowledgeid start with 1 cache 10; create sequence actions_actionid start with 1 cache 10; create sequence alerts_alertid start with 1 cache 10; create sequence applications_applicationid start with 1 cache 10; create sequence auditlog_auditid start with 1 cache 100; create sequence conditions_conditionid start with 1 cache 10; create sequence dchecks_dcheckid start with 1 cache 10; create sequence dhosts_dhostid start with 1 cache 10; create sequence drules_druleid start with 1 cache 10; create sequence dservices_dserviceid start with 1 cache 100; create sequence escalations_escalationid start with 1 cache 100; create sequence events_eventid start with 1 cache 1000; create sequence functions_functionid start with 1 cache 100; create sequence graphs_graphid start with 1 cache 100; create sequence graphs_items_gitemid start with 1 cache 100; create sequence groups_groupid start with 1 cache 10; create sequence history_log_id start with 1 cache 10; create sequence history_text_id start with 1 cache 100; create sequence hosts_hostid start with 1 cache 100; create sequence hosts_groups_hostgroupid start with 1 cache 10; create sequence hosts_templates_hosttemplateid start with 1 cache 10; create sequence housekeeper_housekeeperid start with 1 cache 1000; create sequence httpstep_httpstepid start with 1 cache 10; create sequence httpstepitem_httpstepitemid start with 1 cache 10; create sequence httptest_httptestid start with 1 cache 10; create sequence httptestitem_httptestitemid start with 1 cache 10; create sequence images_imageid start with 1 cache 10; create sequence items_itemid start with 1 cache 100; create sequence items_applications_itemappid start with 1 cache 100; create sequence mappings_mappingid start with 1 cache 10; create sequence media_mediaid start with 1 cache 10; create sequence opconditions_opconditionid start with 1 cache 10; create sequence operations_operationid start with 1 cache 10; create sequence profiles_profileid start with 1 cache 1000; create sequence rights_rightid start with 1 cache 10; create sequence screens_screenid start with 1 cache 10; create sequence screens_items_screenitemid start with 1 cache 10; create sequence service_alarms_servicealarmid start with 1 cache 10; create sequence services_serviceid start with 1 cache 10; create sequence services_links_linkid start with 1 cache 10; create sequence sysmaps_sysmapid start with 1 cache 10; create sequence sysmaps_elements_selementid start with 1 cache 10; create sequence sysmaps_links_linkid start with 1 cache 10; create sequence triggers_triggerid start with 1 cache 100; create sequence user_history_userhistoryid start with 1 cache 10; create sequence users_userid start with 1 cache 10; create sequence users_groups_id start with 1 cache 10; create sequence usrgrp_usrgrpid start with 1 cache 10; create sequence valuemaps_valuemapid start with 1 cache 10;
Code:
SELECT 'create sequence '
|| i.table_name
|| '_'
|| i.field_name --|| '_0'
|| ' start with '
|| ROUND (i.nextid * 1.1)
|| ' cache '
|| CASE
WHEN i.nextid > 100000 THEN '1000'
WHEN i.nextid > 10000 THEN '100'
ELSE '10'
END
|| ';'
FROM ids i
ORDER BY i.table_name ;
è íåïîñðåäñòâåííî ïàò÷ â àòà÷å.
Áîëüøàÿ ïðîñüáà îáðàòèòü âíèìàíèå íà íåãî ðàçðàáîò÷èêàì. Èç-çà ñëèøêîì ÷àñòûõ UPDATE ids âîçíèêàþò concurrency
èç-çà ýòîãî áûâàþò ïðîöåññû îæèäàþò.Äîïîëíèòåëüíî íóæíî ïðîäóìàòü ñáðîñ sequence, íî äóìàþ íàâðÿäëå ïîíàäîáèòñÿ, ò.ê. max value î÷åíü áîëüøîé)
ÇÛ: ìèíóñ ïàò÷à, ò.ê. îæèäàíèå ïðîöåññàìè óìåíüøåíî, òî çàïðîñîâ â ñåêóíäó áîëüøå è íàãðóçêà íà ïðîöåññîð òîæå áîëüøå

Comment