{"id":74953,"date":"2020-03-22T08:42:22","date_gmt":"2020-03-22T05:42:22","guid":{"rendered":"https:\/\/prohoster.info\/blog\/administrirovanie\/dba-gramotno-organizovyvaem-sinhronizaczii-i-importy"},"modified":"2020-03-22T08:42:22","modified_gmt":"2020-03-22T05:42:22","slug":"dba-gramotno-organizovyvaem-sinhronizaczii-i-importy","status":"publish","type":"post","link":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/dba-gramotno-organizovyvaem-sinhronizaczii-i-importy","title":{"rendered":"DBA: organizojm\u00eb n\u00eb m\u00ebnyr\u00eb t\u00eb duhur sinkronizimet dhe importet","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p>Kur b\u00ebhet fjal\u00eb p\u00ebr p\u00ebrpunimin kompleks t\u00eb grupeve t\u00eb m\u00ebdha t\u00eb dh\u00ebnash (t\u00eb ndryshme <noindex><a rel=\"nofollow\" href=\"https:\/\/ru.wikipedia.org\/wiki\/ETL\">proceset ETL<\/a><\/noindex>: importime, konvertime dhe sinkronizime me burime t\u00eb jashtme) shpesh lind nevoja <b>p\u00ebr t\u00eb \"mbajtur mend\" p\u00ebrkoh\u00ebsisht dhe p\u00ebr t'i p\u00ebrpunuar shpejt<\/b> di\u00e7ka voluminoze.<\/p>\n<p>Nj\u00eb detyr\u00eb tipike e k\u00ebtij lloji zakonisht formulon si m\u00eb posht\u00eb: <i>\"K\u00ebtu <noindex><a rel=\"nofollow\" href=\"https:\/\/sbis.ru\/accounting\">financial po eksporton nga banka e klientit<\/a><\/noindex> pagesat m\u00eb t\u00eb fundit t\u00eb pranuara, duhet t'i ngarkojm\u00eb shpejt n\u00eb faqe dhe t'i lidhim me llogarit\u00eb\"<\/i><\/p>\n<p>Por kur volum i k\u00ebtij \"di\u00e7kaje\" fillon t\u00eb matet n\u00eb qindra megabajt, nd\u00ebrsa sh\u00ebrbimi duhet t\u00eb vazhdoj\u00eb t\u00eb punoj\u00eb me nj\u00eb baz\u00eb n\u00eb m\u00ebnyr\u00eb 24&#215;7, lindin shum\u00eb efekte an\u00ebsore q\u00eb do t\u00eb d\u00ebmtojn\u00eb jet\u00ebn tuaj.<br \/>\n<img decoding=\"async\" alt=\"DBA: organizojm\u00eb n\u00eb m\u00ebnyr\u00eb t\u00eb duhur sinkronizimet dhe importet\" src=\"\/wp-content\/uploads\/2020\/03\/f74afb2cd6f5f8de26a0932166933c95.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\nP\u00ebr t'u p\u00ebrballur me ta n\u00eb PostgreSQL (po ashtu edhe n\u00eb t\u00eb tjer\u00ebt), mund t\u00eb p\u00ebrdoren disa mund\u00ebsi p\u00ebr optimizim, t\u00eb cilat do t\u00eb lejojn\u00eb t\u00eb p\u00ebrpunoni gjith\u00e7ka m\u00eb shpejt dhe me m\u00eb pak burime.<br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h2>1. Ku t\u00eb ngarkojm\u00eb?<\/h2>\n<p>\nS\u00eb pari, le t\u00eb p\u00ebrcaktojm\u00eb se ku mund t\u00eb ngarkojm\u00eb t\u00eb dh\u00ebnat q\u00eb d\u00ebshirojm\u00eb \"t\u00eb procesojm\u00eb\".<\/p>\n<h3>1.1. Tabela p\u00ebrkohshme (TEMPORARY TABLE)<\/h3>\n<p>\nN\u00eb princip, p\u00ebr PostgreSQL, tabelat e p\u00ebrkohshme jan\u00eb si \u00e7do tabel\u00eb tjet\u00ebr. Prandaj, superstitions si <i><b>\"ato ruhen vet\u00ebm n\u00eb memorie, dhe ajo mund t\u00eb mbaroj\u00eb\"<\/b><\/i>jan\u00eb t\u00eb pasakta. Po ashtu, ka disa dallime t\u00eb r\u00ebnd\u00ebsishme.<\/p>\n<h4>Nj\u00eb \"hap\u00ebsir\u00eb emri\" p\u00ebr \u00e7do lidhje n\u00eb BDB<\/h4>\n<p>\nN\u00ebse dy lidhje p\u00ebrpiqen nj\u00ebkoh\u00ebsisht t\u00eb kryejn\u00eb <code>KRIJO TABELA x<\/code>, at\u00ebher\u00eb dikush patjet\u00ebr do t\u00eb marr\u00eb <b>nj\u00eb gabim unikaliteti<\/b> t\u00eb objekteve t\u00eb BDB.<\/p>\n<p>Por n\u00ebse t\u00eb dy p\u00ebrpiqen t\u00eb kryejn\u00eb <code>KRIJO <b>TEMPORARY<\/b> TABELA x<\/code>, at\u00ebher\u00eb t\u00eb dy e realizojn\u00eb normalisht, dhe secili merr <b>ekzemplarin e vet<\/b> tabel\u00ebs. Dhe nuk ka asgj\u00eb t\u00eb p\u00ebrbashk\u00ebt midis tyre.<\/p>\n<h4>\"Vet\u00eb-shkat\u00ebrrimi\" kur u ndale lidhja<\/h4>\n<p>\nKur lidhja mbyllet, t\u00eb gjitha tabelat p\u00ebrkohshme fshihen automatikisht, prandaj nuk ka asnj\u00eb kuptim t\u00eb b\u00ebni <code>DROP TABLE x<\/code> p\u00ebrve\u00e7\u2026<\/p>\n<p>N\u00ebse punoni p\u00ebrmes <b>pgbouncer n\u00eb modin e transaksionit<\/b>, at\u00ebher\u00eb baza vazhdon t\u00eb mendoj\u00eb se kjo lidhje \u00ebsht\u00eb ende aktive, dhe tabela p\u00ebrkohshme ende ekziston n\u00eb t\u00eb.<\/p>\n<p>Prandaj, p\u00ebrpjekja p\u00ebr ta krijuar p\u00ebrs\u00ebri, tashm\u00eb nga nj\u00eb lidhje tjet\u00ebr n\u00eb pgbouncer, do t\u00eb \u00e7oj\u00eb n\u00eb nj\u00eb gabim. Por kjo mund t\u00eb zgjidhet duke p\u00ebrdorur <code>KRIJONI TABEL\u00cb TEMPORALE <b>N\u00cbSE NUK EKZISTON<\/b> x<\/code>.<\/p>\n<p>Megjithat\u00eb, \u00ebsht\u00eb m\u00eb mir\u00eb ta b\u00ebni k\u00ebshtu, sepse mund t\u00eb \"zbuloni papritur\" ato t\u00eb dh\u00ebna t\u00eb mbetura nga \"pronari i m\u00ebparsh\u00ebm\". N\u00eb vend t\u00eb k\u00ebsaj, \u00ebsht\u00eb shum\u00eb m\u00eb mir\u00eb t\u00eb lexoni p\u00ebrgjith\u00ebsisht manualin, dhe t\u00eb shikoni se gjat\u00eb krijimit t\u00eb tabel\u00ebs ka mund\u00ebsin\u00eb t\u00eb shtoni <code>P\u00cbR ANGAZHIM <b>DROP<\/b><\/code> \u2014 pra, n\u00eb p\u00ebrfundim t\u00eb transaksionit, tabela do t\u00eb fshihet automatikisht.<\/p>\n<h4>Jo-replikimi<\/h4>\n<p>\nP\u00ebr shkak t\u00eb p\u00ebrkat\u00ebsis\u00eb vet\u00ebm ndaj nj\u00eb lidhjeje t\u00eb caktuar, tabelat p\u00ebrkohshme nuk replikohen. P\u00ebr m\u00eb tep\u00ebr, <b>kjo ndihmon p\u00ebr t\u00eb shmangur nevoj\u00ebn p\u00ebr shkrim t\u00eb dyfisht\u00eb t\u00eb t\u00eb dh\u00ebnave<\/b> n\u00eb heap + WAL, k\u00ebshtu q\u00eb INSERT\/UPDATE\/DELETE n\u00eb to \u00ebsht\u00eb shum\u00eb m\u00eb i shpejt\u00eb.<\/p>\n<p>Por p\u00ebr shkak se tabelat e p\u00ebrkohshme jan\u00eb p\u00ebrfundimisht \"dhe\" tabelat \"normale\", ato nuk mund t\u00eb krijohen as n\u00eb replik\u00eb gjithashtu. T\u00eb pakt\u00ebn p\u00ebr momentin, megjith\u00ebse nj\u00eb patch p\u00ebrkat\u00ebs qarkullon prej nj\u00eb kohe t\u00eb gjat\u00eb.<\/p>\n<h3>1.2. Tabela t\u00eb pa-journal (UNLOGGED TABLE)<\/h3>\n<p>\nPor, \u00e7far\u00eb duhet t\u00eb b\u00ebni, p\u00ebr shembull, n\u00ebse keni nj\u00eb proces ETL t\u00eb r\u00ebnd\u00eb, q\u00eb nuk mund ta realizoni brenda nj\u00eb transaksioni, dhe ju keni <b>pgbouncer n\u00eb modin e transaksionit<\/b>?..<\/p>\n<p>Ose fluksi i t\u00eb dh\u00ebnave \u00ebsht\u00eb aq i madh sa <b>kapaciteti i nj\u00eb lidhje<\/b> me BDB (lexo, nj\u00eb proces n\u00eb CPU) nuk \u00ebsht\u00eb i mjaftuesh\u00ebm? ..<\/p>\n<p>Ose disa operacione shkojn\u00eb <b>asinhron<\/b> n\u00eb lidhje t\u00eb ndryshme?..<\/p>\n<p>N\u00eb k\u00ebt\u00eb raste, nj\u00eb mund\u00ebsi e vetme mbetet \u2014 <b>t\u00eb krijoni p\u00ebrkoh\u00ebsisht nj\u00eb tabel\u00eb jo-p\u00ebrkoh\u00ebshe.<\/b>Nj\u00eb ironia, po. Dometh\u00ebn\u00eb,<\/p>\n<ul>\n<li>krijoni \"tabelat\" tuaja me emra sa m\u00eb rast\u00ebsor\u00eb dhe unik\u00eb, p\u00ebr t\u00eb mos u nd\u00ebrprer\u00eb<\/li>\n<li><b>Ekstrakt<\/b>: ngarko n\u00eb to t\u00eb dh\u00ebna nga burimi i jasht\u00ebm<\/li>\n<li><b>Transformo<\/b>: transformuat, plot\u00ebsuan fushat ky\u00e7e lidh\u00ebse<\/li>\n<li><b>Ngarko<\/b>: transferuan t\u00eb dh\u00ebnat e gatshme n\u00eb tabelat p\u00ebrkat\u00ebse<\/li>\n<li>fshini \"tabelat\" tuaja<\/li>\n<\/ul>\n<p>\nDhe tani \u2014 nj\u00eb lug\u00eb helm. N\u00eb thelb, <b>i gjith\u00eb shkrimi n\u00eb PostgreSQL ndodh dy her\u00eb<\/b> \u2014 <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/postgrespro\/blog\/461523\/\">s\u00eb pari n\u00eb WAL<\/a><\/noindex>, pastaj n\u00eb trupat e tabelave\/indekseve. T\u00eb gjitha k\u00ebto jan\u00eb b\u00ebr\u00eb p\u00ebr t\u00eb mb\u00ebshtetur ACID dhe p\u00ebr t\u00eb siguruar dukshm\u00ebrin\u00eb e sakt\u00eb t\u00eb t\u00eb dh\u00ebnave midis <code>COMMIT<\/code>\u2018p\u00ebrfshir\u00eb dhe <code>RIVENDOS<\/code>\u2018p\u00ebrfshir\u00eb transaksionet.<\/p>\n<p>Por ne nuk e duam k\u00ebt\u00eb! T\u00eb gjith\u00eb procesi <b>ose ka kaluar me sukses, ose jo.<\/b>Nuk ka r\u00ebnd\u00ebsi se sa transaksione nd\u00ebrmjet\u00ebsore do t\u00eb ket\u00eb \u2014 nuk na intereson \"t\u00eb vazhdojm\u00eb procesin nga mesi\", sidomos kur nuk \u00ebsht\u00eb e qart\u00eb ku ishte.<\/p>\n<p>P\u00ebr k\u00ebt\u00eb, zhvilluesit e PostgreSQL q\u00eb n\u00eb versionin 9.1 zbatuan nj\u00eb gj\u00eb si <noindex><a rel=\"nofollow\" href=\"https:\/\/postgrespro.ru\/docs\/postgresql\/12\/sql-createtable#SQL-CREATETABLE-UNLOGGED\">tabela t\u00eb pa-journal (UNLOGGED)<\/a><\/noindex>:<\/p>\n<blockquote><p>Me k\u00ebt\u00eb p\u00ebrcaktim, tabela krijohet si e pa-journal. T\u00eb dh\u00ebnat e shkruara n\u00eb tabelat e pa-journal nuk kalojn\u00eb p\u00ebrmes regjistrit t\u00eb parashkrimit (shih Kapitullin 29), si rezultat i s\u00eb cil\u00ebs k\u00ebto tabela <b>punojn\u00eb shum\u00eb m\u00eb shpejt se t\u00eb zakonshmet.<\/b>Megjithat\u00eb, ato nuk jan\u00eb t\u00eb mbrojtura nga d\u00ebshtimi; n\u00eb rast d\u00ebshtimi ose ndalimi t\u00eb papritur t\u00eb serverit, tabela e pa-journal <b>automatikisht pritet.<\/b>P\u00ebr m\u00eb tep\u00ebr, p\u00ebrmbajtja e tabel\u00ebs s\u00eb pa-journal <b>nuk replikon<\/b> n\u00eb server\u00eb t\u00eb drejtp\u00ebrdrejt\u00eb. \u00c7do indeks i krijuar p\u00ebr nj\u00eb tabel\u00eb t\u00eb pasiguruar automatikisht b\u00ebhet i till\u00eb.<\/p><\/blockquote>\n<p>P\u00ebr t\u00eb shpejtuar, <b>do t\u00eb jet\u00eb shum\u00eb m\u00eb shpejt<\/b>, por n\u00ebse serveri i t\u00eb dh\u00ebnave \"bjer\u00eb\" \u2014 do t\u00eb jet\u00eb e pak\u00ebndshme. Por a ndodh shpesh kjo, dhe a arrin procesi juaj ETL ta p\u00ebrmir\u00ebsoj\u00eb \"nga mesi\" pas \"ringjalljes\" s\u00eb DB?..<\/p>\n<p>N\u00ebse jo, dhe rasti lart \u00ebsht\u00eb i ngjash\u00ebm me tuajin \u2014 p\u00ebrdorni <code>UNLOGGED<\/code>, por kurr\u00eb <b>mos e aktivizoni k\u00ebt\u00eb atribut n\u00eb tabelat reale<\/b>, t\u00eb dh\u00ebnat nga t\u00eb cilat ju r\u00ebndojn\u00eb.<\/p>\n<h3>1.3. ON COMMIT { DELETE ROWS | DROP }<\/h3>\n<p>\nKjo nd\u00ebrtim lejon q\u00eb gjat\u00eb krijimit t\u00eb tabel\u00ebs t\u00eb caktosh sjelljen automatike pas p\u00ebrfundimit t\u00eb transaksionit.<\/p>\n<p>P\u00ebr <code>P\u00cbR ANGAZHIM <b>DROP<\/b><\/code> e kam shkruar m\u00eb par\u00eb, ai gjeneron <code>DROP TABLE<\/code>, por me <code>P\u00cbR ANGAZHIM <b>Fshi Rreshtat<\/b><\/code> situata \u00ebsht\u00eb m\u00eb interesante \u2014 k\u00ebtu gjenerohet <code>TRUNCATE TABLE<\/code>.<\/p>\n<p>N\u00ebse e gjith\u00eb infrastruktura e ruajtjes s\u00eb meta p\u00ebrshkrimit t\u00eb tabel\u00ebs p\u00ebrkohshme \u00ebsht\u00eb pik\u00ebrisht e nj\u00ebjt\u00eb si ajo e normales, at\u00ebher\u00eb <b>krijimi dhe fshirja e vazhdueshme e tabelave t\u00eb p\u00ebrkohshme \u00e7on n\u00eb \"shk\u00ebmbim\" t\u00eb madh t\u00eb tabelave sistemike<\/b> pg_class, pg_attribute, pg_attrdef, pg_depend,\u2026<\/p>\n<p>Tani imagjinoni se keni nj\u00eb pun\u00ebtor q\u00eb ka nj\u00eb lidhje t\u00eb drejtp\u00ebrdrejt\u00eb me DB, i cili \u00e7do sekond\u00eb hap nj\u00eb transaksion t\u00eb ri, krijon, mbush, p\u00ebrpunon dhe fshin nj\u00eb tabel\u00eb t\u00eb p\u00ebrkohshme\u2026 Do t\u00eb akumulohet tepri n\u00eb tabelat sistemike, dhe kjo do t\u00eb shkaktoj\u00eb ngadal\u00ebsime n\u00eb \u00e7do operacion.<\/p>\n<p>N\u00eb p\u00ebrgjith\u00ebsi, mos e b\u00ebni k\u00ebshtu! N\u00eb k\u00ebt\u00eb rast, \u00ebsht\u00eb shum\u00eb m\u00eb efektive <code>CREATE TEMPORARY TABLE x ... ON COMMIT DELETE ROWS<\/code> ta nxjerr\u00ebsh jasht\u00eb ciklit t\u00eb transaksioneve \u2014 at\u00ebher\u00eb n\u00eb fillim t\u00eb \u00e7do transaksioni t\u00eb ri, tabelat do t\u00eb <b>ekzistojn\u00eb<\/b> (shkurtim i thirrjes <code>KRIJO<\/code>), por <b>do t\u00eb jen\u00eb bosh<\/b>, fal\u00eb <code>TRUNCATE<\/code> (thirrjen e tij gjithashtu e kursyem) pas p\u00ebrfundimit t\u00eb transaksionit t\u00eb m\u00ebparsh\u00ebm.<\/p>\n<h3>1.4. SI\u2026 P\u00cbRFAKSISHT \u2026<\/h3>\n<p>\nE p\u00ebrmenda n\u00eb fillim, se nj\u00eb nga rastet tipike p\u00ebr tabelat e p\u00ebrkohshme \u00ebsht\u00eb lloje t\u00eb ndryshme importesh \u2014 dhe zhvilluesi ngre duar e kopjon list\u00ebn e fushave t\u00eb tabel\u00ebs q\u00ebllimore p\u00ebr deklarat\u00ebn e tabel\u00ebs s\u00eb tij t\u00eb p\u00ebrkohshme\u2026<\/p>\n<p>Por lenia \u2014 \u00ebsht\u00eb motor progresi! Prandaj <b>krijimi i nj\u00eb tabele t\u00eb re \"n\u00eb baz\u00eb t\u00eb modelit\"<\/b> mund t\u00eb b\u00ebhet shum\u00eb m\u00eb leht\u00eb:<\/p>\n<pre><code class=\"sql\">CREATE TEMPORARY TABLE import_table(\n  LIKE target_table\n);<\/code><\/pre>\n<p>\nDuke pasur parasysh se n\u00eb k\u00ebt\u00eb tabel\u00eb mund t\u00eb gjenerohen shum\u00eb t\u00eb dh\u00ebna, k\u00ebrkimet n\u00eb t\u00eb do t\u00eb jen\u00eb aspak t\u00eb shpejta. Por p\u00ebr k\u00ebt\u00eb ka nj\u00eb zgjidhje tradicionale \u2014 indikes! Po, po ashtu, <b>tabela e p\u00ebrkohshme mund t\u00eb ket\u00eb indikes<\/b>.<\/p>\n<p>Duke qen\u00eb se, shpesh, indiket e nevojshme p\u00ebrputhen me indiket e tabel\u00ebs s\u00eb q\u00ebllimit, mund t\u00eb shkruani thjesht <code>SI target_table <b>DUKE INDICES<\/b><\/code>.<\/p>\n<p>N\u00ebse ju nevojiten edhe <code>DEFAULT<\/code>-vlerat (p\u00ebr shembuj, p\u00ebr t\u00eb mbushur vlerat e \u00e7el\u00ebsit primar), mund t\u00eb p\u00ebrdorni <code>SI target_table <b>P\u00cbRFSHIR\u00cb DHE T\u00cb DH\u00cbNAT E KUFIZUARA<\/b><\/code>. Ose thjesht \u2014 <code>SI target_table <b>P\u00cbRFSHIJ\u00cb GJITHA<\/b><\/code> \u2014 do t\u00eb kopjoj\u00eb defoltet, indiket, kufizimet,\u2026<\/p>\n<p>Por n\u00eb k\u00ebt\u00eb rast, duhet t\u00eb kuptohet se n\u00ebse e keni krijuar <b>tabel\u00ebn e importit menj\u00ebher\u00eb me indikes, t\u00eb dh\u00ebnat do t\u00eb futen m\u00eb ngadal\u00eb<\/b>, sesa n\u00ebse fillimisht i futni t\u00eb gjitha, dhe m\u00eb pas i aplikoni indiket \u2014 shikoni p\u00ebr t\u00eb m\u00ebsuar se si e b\u00ebn <noindex><a rel=\"nofollow\" href=\"https:\/\/postgrespro.ru\/docs\/postgresql\/12\/app-pgdump\">pg_dump<\/a><\/noindex>.<\/p>\n<p>N\u00eb p\u00ebrgjith\u00ebsi, <noindex><a rel=\"nofollow\" href=\"https:\/\/postgrespro.ru\/docs\/postgresql\/12\/sql-createtable\">RTFM<\/a><\/noindex>!<\/p>\n<h2>2. Si t\u00eb shkruani?<\/h2>\n<p>\nDo ta them thjesht \u2014 p\u00ebrdorni <code><noindex><a rel=\"nofollow\" href=\"https:\/\/postgrespro.ru\/docs\/postgresql\/12\/sql-copy\">COPY<\/a><\/noindex><\/code>-rrjedh\u00ebn n\u00eb vend t\u00eb \"kufiz\u00ebve\" <code>INSERT<\/code>, <noindex><a rel=\"nofollow\" href=\"https:\/\/www.citusdata.com\/blog\/2017\/11\/08\/faster-bulk-loading-in-postgresql-with-copy\/\">p\u00ebrshpejtim me p\u00ebrqindje<\/a><\/noindex>. Mund t\u00eb b\u00ebhet edhe direkt nga nj\u00eb skedar i formuar paraprakisht.<\/p>\n<h2>3. Si t\u00eb p\u00ebrpunoni?<\/h2>\n<p>\nPra, le t\u00eb thjeshtojm\u00eb se k\u00ebtu kemi nj\u00eb hyrje t\u00eb ngjashme:<\/p>\n<ul>\n<li>keni nj\u00eb tabel\u00eb n\u00eb baz\u00eb t\u00eb t\u00eb dh\u00ebnave me <b>1M regjistrime<\/b><\/li>\n<li>\u00e7do dit\u00eb klienti ju d\u00ebrgon nj\u00eb <b>t\u00eb plot\u00eb \"model\"<\/b><\/li>\n<li>sip\u00ebr p\u00ebrvoj\u00ebs, e dini se nga nj\u00eb her\u00eb n\u00eb tjet\u00ebr <b>ndryshojn\u00eb jo m\u00eb shum\u00eb se 10K regjistrime<\/b><\/li>\n<\/ul>\n<p>\nNj\u00eb shembull klasik i nj\u00eb situate t\u00eb till\u00eb \u00ebsht\u00eb <noindex><a rel=\"nofollow\" href=\"https:\/\/www.gnivc.ru\/technical_support\/classifiers_reference\/kladr\/\">baza KLA-DR<\/a><\/noindex> \u2014 gjithsej adresa t\u00eb shumta, por n\u00eb \u00e7do p\u00ebrpunim t\u00eb p\u00ebrjavsh\u00ebm t\u00eb ndryshimeve (ndryshimet e emrave t\u00eb vendeve, bashkimeve t\u00eb rrug\u00ebve, shfaqja e sht\u00ebpive t\u00eb reja) ka shum\u00eb pak madje edhe n\u00eb shkall\u00eb t\u00eb gjat\u00eb.<\/p>\n<h3>3.1. Algoritmi i sinkronizimit t\u00eb plot\u00eb<\/h3>\n<p>\nP\u00ebr thjesht\u00ebsi, le t\u00eb themi se nuk \u00ebsht\u00eb e nevojshme ta rishtrosh t\u00eb dh\u00ebnat \u2014 thjesht t'i sillni tabel\u00ebs pamjen e duhur, dmth:<\/p>\n<ul>\n<li><b>t\u00eb fshij\u00eb<\/b> gjith\u00eb ato q\u00eb nuk jan\u00eb m\u00eb<\/li>\n<li><b>p\u00ebrdit\u00ebsoni<\/b> gjith\u00eb ato q\u00eb tashm\u00eb ishin dhe nevojiten p\u00ebr p\u00ebrdit\u00ebsim<\/li>\n<li><b>futni<\/b> gjith\u00eb ato q\u00eb akoma nuk ishin<\/li>\n<\/ul>\n<p>\nPse pik\u00ebrisht n\u00eb k\u00ebt\u00eb rend do t\u00eb duhej t\u00eb b\u00ebnit operacionet? Sepse k\u00ebshtu do t\u00eb rritet sa m\u00eb pak madh\u00ebsia e tabel\u00ebs (<noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/tensor\/blog\/491366\/\">mbani mend p\u00ebr MVCC!<\/a><\/noindex>).<\/p>\n<h4>DELETE FROM dst<\/h4>\n<p>\nJo, natyrisht mund ta p\u00ebrdorni vet\u00ebm dy operacione:<\/p>\n<ul>\n<li><b>t\u00eb fshij\u00eb<\/b> (<code>DELETE<\/code>) t\u00eb gjith\u00eb<\/li>\n<li><b>futni<\/b> t\u00eb gjith\u00eb nga modeli i ri<\/li>\n<\/ul>\n<p>\nPor ndodhi q\u00eb fal\u00eb MVCC, <b>madh\u00ebsia e tabel\u00ebs do t\u00eb rritet pik\u00ebrisht dyfish<\/b>! T\u00eb merrni +1M modele regjistrimesh n\u00eb tabel\u00eb p\u00ebr shkak t\u00eb p\u00ebrdit\u00ebsimit t\u00eb 10K \u2014 nuk \u00ebsht\u00eb t\u00ebrheqja m\u00eb e madhe\u2026<\/p>\n<h4>TRUNCATE dst<\/h4>\n<p>\nNj\u00eb zhvillues m\u00eb me p\u00ebrvoj\u00eb e di se \u00ebsht\u00eb mjaft e lir\u00eb t\u00eb fshini t\u00ebr\u00eb tabel\u00ebn:<\/p>\n<ul>\n<li><b>pastroni<\/b> (<code>TRUNCATE<\/code>) tabel\u00ebn e t\u00ebr\u00eb<\/li>\n<li><b>futni<\/b> t\u00eb gjith\u00eb nga modeli i ri<\/li>\n<\/ul>\n<p>\nMetoda \u00ebsht\u00eb efektive, <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/tensor\/blog\/481866\/\">ndonj\u00ebher\u00eb plot\u00ebsisht e zbatueshme<\/a><\/noindex>, por ka nj\u00eb shqet\u00ebsim\u2026 T\u00eb futni 1M regjistrime do t\u00eb zgjas\u00eb shum\u00eb, prandaj nuk mund ta lejojm\u00eb tabel\u00ebn t\u00eb jet\u00eb bosh p\u00ebr gjith\u00eb k\u00ebt\u00eb koh\u00eb (si\u00e7 do ndodhte pa u vendosur n\u00eb nj\u00eb transaksion t\u00eb vet\u00ebm).<\/p>\n<p>Dhe k\u00ebshtu:<\/p>\n<ul>\n<li>jemi duke filluar <b>transaksionin e gjat\u00eb<\/b><\/li>\n<li><code>TRUNCATE<\/code> ngarkon <b>bllokimin AccessExclusive<\/b>ne e b\u00ebjm\u00eb ngadal\u00eb futjen, nd\u00ebrsa t\u00eb tjer\u00ebt gjat\u00eb k\u00ebsaj kohe<\/li>\n<li>nuk mund as <b>Nuk \u00ebsht\u00eb gjith\u00e7ka n\u00eb rregull... <code>SELECT<\/code><\/b><\/li>\n<\/ul>\n<p>\nDicka nuk po shkon mir\u00eb...<\/p>\n<h4>ALTER TABLE\u2026 RENAME\u2026 \/ DROP TABLE \u2026<\/h4>\n<p>\nNj\u00eb mund\u00ebsi \u00ebsht\u00eb t\u00eb ngarkoni gjith\u00e7ka n\u00eb nj\u00eb tabel\u00eb t\u00eb re, dhe pastaj thjesht ta ribeni me emrin e tabel\u00ebs s\u00eb vjet\u00ebr. Disa detaje t\u00eb pak\u00ebndshme:<\/p>\n<ul>\n<li>edhe kjo <b>bllokimin AccessExclusive<\/b>, ndon\u00ebse ndjesh\u00ebm m\u00eb pak n\u00eb koh\u00eb<\/li>\n<li>t\u00eb gjith\u00eb planet e k\u00ebrkesave\/statistik\u00ebn e k\u00ebsaj tabele do t\u00eb humbasin, <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/tensor\/blog\/479656\/\">duhet t\u00eb ekzekutohet ANALYZE<\/a><\/noindex><\/li>\n<li><b>t\u00eb gjith\u00eb \u00e7el\u00ebsat e jasht\u00ebm<\/b> (FK) p\u00ebr tabel\u00ebn<\/li>\n<\/ul>\n<p>\nIshte nj\u00eb patch WIP nga Simon Riggs, i cili propozonte t\u00eb b\u00ebnte <code>ALTER<\/code>-operacion p\u00ebr t\u00eb z\u00ebvend\u00ebsuar trupin e tabel\u00ebs n\u00eb nivelin e skedarit, pa prekur statistik\u00ebn dhe FK, por nuk arriti t\u00eb mbledh\u00eb shumic\u00ebn.<\/p>\n<h4>DELETE, UPDATE, INSERT<\/h4>\n<p>\nPra, ndalojm\u00eb n\u00eb variantin q\u00eb nuk bllokon nga tre operacione. Pothuajse tre\u2026 Si ta b\u00ebjm\u00eb k\u00ebt\u00eb sa m\u00eb efikasht?<\/p>\n<pre><code class=\"sql\">-- gjith\u00e7ka e b\u00ebjm\u00eb n\u00eb kuad\u00ebr t\u00eb transaksionit, n\u00eb m\u00ebnyr\u00eb q\u00eb askush t\u00eb mos e shihte \"gjendjet p\u00ebrkoh\u00ebsore\"\nBEGIN;\n\n-- krijojm\u00eb nj\u00eb tabel\u00eb p\u00ebrkoh\u00ebsore me t\u00eb dh\u00ebnat e importuara\nCREATE TEMPORARY TABLE tmp(\n  LIKE dst INCLUDING INDEXES -- sipas modelit, s\u00eb bashku me indekset\n) ON COMMIT DROP; -- jasht\u00eb transaksionit nuk na nevojitet\n\n-- shpejt-huqi shterojm\u00eb imazhin e ri p\u00ebrmes COPY\nCOPY tmp FROM STDIN;\n-- ...\n-- .\n\n-- fshijm\u00eb ata q\u00eb mungojn\u00eb\nDELETE FROM\n  dst D\nUSING\n  dst X\nLEFT JOIN\n  tmp Y\n    USING(pk1, pk2) -- fushat e \u00e7el\u00ebsit primar\nWHERE\n  (D.pk1, D.pk2) = (X.pk1, X.pk2) AND\n  Y IS NOT DISTINCT FROM NULL; -- \"antijoin\"\n\n-- p\u00ebrdit\u00ebsojm\u00eb ata q\u00eb mbeten\nUPDATE\n  dst D\nSET\n  (f1, f2, f3) = (T.f1, T.f2, T.f3)\nFROM\n  tmp T\nWHERE\n  (D.pk1, D.pk2) = (T.pk1, T.pk2) AND\n  (D.f1, D.f2, D.f3) IS DISTINCT FROM (T.f1, T.f2, T.f3); -- nuk ka nevoj\u00eb t\u00eb p\u00ebrdit\u00ebsojm\u00eb t\u00eb klinjt\u00eb\n\n-- futim at\u00eb q\u00eb mungon\nINSERT INTO\n  dst\nSELECT\n  T.*\nFROM\n  tmp T\nLEFT JOIN\n  dst D\n    USING(pk1, pk2)\nWHERE\n  D IS NOT DISTINCT FROM NULL;\n\nCOMMIT;\n<\/code><\/pre>\n<p><\/p>\n<h3>3.2. Pastrimi i importit<\/h3>\n<p>\nN\u00eb t\u00eb nj\u00ebjtin KLADr, t\u00eb gjith\u00eb regjistrat e ndryshuar duhet t\u00eb kalojn\u00eb p\u00ebrmes pastrimit - t\u00eb normalizohen, t\u00eb nxjerrin fjal\u00eb ky\u00e7e, t\u00eb sjellin n\u00eb struktura t\u00eb nevojshme. Por si mund ta dim\u00eb - <b>\u00e7far\u00eb \u00ebsht\u00eb ndryshuar<\/b>, pa e komplikuar kodin e sinkronizimit, n\u00eb m\u00ebnyr\u00eb ideale, madje pa e prekur at\u00eb?<\/p>\n<p>N\u00ebse akseset p\u00ebr shkrim gjat\u00eb sinkronizimit jan\u00eb vet\u00ebm p\u00ebr procesin tuaj, mund t\u00eb p\u00ebrdorni nj\u00eb trigger, i cili do t\u00eb mbledh\u00eb t\u00eb gjitha ndryshimet p\u00ebr ne:<\/p>\n<pre><code class=\"sql\">-- tabelat e synuara\nCREATE TABLE kladr(...);\nCREATE TABLE kladr_house(...);\n\n-- tabelat me historin\u00eb e ndryshimeve\nCREATE TABLE kladr$log(\n  ro kladr, -- k\u00ebtu ruajm\u00eb imazhet e plota t\u00eb regjistrave t\u00eb vjet\u00ebr\/t\u00eb rinj\n  rn kladr\n);\n\nCREATE TABLE kladr_house$log(\n  ro kladr_house,\n  rn kladr_house\n);\n\n-- funksioni i p\u00ebrbashk\u00ebt p\u00ebr logimin e ndryshimeve\nCREATE OR REPLACE FUNCTION diff$log() RETURNS trigger AS $$\nDECLARE\n  dst varchar = TG_TABLE_NAME || '$log';\n  stmt text = '';\nBEGIN\n  -- kontrollojm\u00eb nevoj\u00ebn p\u00ebr logimin kur p\u00ebrdit\u00ebsohet nj\u00eb regjist\u00ebr\n  IF TG_OP = 'UPDATE' THEN\n    IF NEW IS NOT DISTINCT FROM OLD THEN\n      RETURN NEW;\n    END IF;\n  END IF;\n  -- krijojm\u00eb nj\u00eb regjist\u00ebr logu\n  stmt = 'INSERT INTO ' || dst::text || '(ro,rn)VALUES(';\n  CASE TG_OP\n    WHEN 'INSERT' THEN\n      EXECUTE stmt || 'NULL,$1)' USING NEW;\n    WHEN 'UPDATE' THEN\n      EXECUTE stmt || '$1,$2)' USING OLD, NEW;\n    WHEN 'DELETE' THEN\n      EXECUTE stmt || '$1,NULL)' USING OLD;\n  END CASE;\n  RETURN NEW;\nEND;\n$$ LANGUAGE plpgsql;\n<\/code><\/pre>\n<p>\nTani ne mund t\u00eb aplikojm\u00eb triggers para fillimit t\u00eb sinkronizimit (ose t\u2019i aktivizojm\u00eb p\u00ebrmes <code>ALTER TABLE ... ENABLE TRIGGER ...<\/code>):<\/p>\n<pre><code class=\"sql\">CREATE TRIGGER log\n  AFTER INSERT OR UPDATE OR DELETE\n  ON kladr\n    FOR EACH ROW\n      EXECUTE PROCEDURE diff$log();\n\nCREATE TRIGGER log\n  AFTER INSERT OR UPDATE OR DELETE\n  ON kladr_house\n    FOR EACH ROW\n      EXECUTE PROCEDURE diff$log();\n<\/code><\/pre>\n<p>\nDhe pastaj qet\u00eb nga tabelat log nxjerrim t\u00eb gjitha ndryshimet q\u00eb na nevojiten dhe i kalojm\u00eb p\u00ebrmes p\u00ebrpunuesve t\u00eb tjer\u00eb.<\/p>\n<h3>3.3. Importi i grupeve t\u00eb lidhura<\/h3>\n<p>\nM\u00eb sip\u00ebr kemi shqyrtuar rastet kur strukturat e t\u00eb dh\u00ebnave t\u00eb burimit dhe t\u00eb pranimit bien ndesh. Por \u00e7far\u00eb t\u00eb b\u00ebjm\u00eb, n\u00ebse eksportimi nga nj\u00eb sistem t\u00eb jasht\u00ebm ka nj\u00eb format ndryshe nga struktura q\u00eb kemi n\u00eb baz\u00ebn ton\u00eb?<\/p>\n<p>Merrni p\u00ebr shembull ruajtjen e klient\u00ebve dhe faturave p\u00ebr ta, nj\u00eb variant klasik 'shum\u00eb-n\u00eb-nj\u00eb':<\/p>\n<pre><code class=\"sql\">CREATE TABLE client(\n  client_id\n    serial\n      PRIMARY KEY\n, inn\n    varchar\n      UNIQUE\n, name\n    varchar\n);\n\nCREATE TABLE invoice(\n  invoice_id\n    serial\n      PRIMARY KEY\n, client_id\n    integer\n      REFERENCES client(client_id)\n, number\n    varchar\n, dt\n    date\n, sum\n    numeric(32,2)\n);<\/code><\/pre>\n<p>\nDhe k\u00ebshtu eksportimi nga nj\u00eb burim t\u00eb jasht\u00ebm vjen n\u00eb form\u00ebn e 'gjith\u00e7ka n\u00eb nj\u00eb':<\/p>\n<pre><code class=\"sql\">CREATE TEMPORARY TABLE invoice_import(\n  client_inn\n    varchar\n, client_name\n    varchar\n, invoice_number\n    varchar\n, invoice_dt\n    date\n, invoice_sum\n    numeric(32,2)\n);<\/code><\/pre>\n<p>\nE qart\u00eb se t\u00eb dh\u00ebnat p\u00ebr klient\u00ebt mund t\u00eb dyfishohen n\u00eb k\u00ebt\u00eb variant, dhe regjistri kryesor \u00ebsht\u00eb 'fatura':<\/p>\n<pre><code class=\"plaintext\">0123456789;Vasia;A-01;2020-03-16;1000.00\n9876543210;Petya;A-02;2020-03-16;666.00\n0123456789;Vasia;B-03;2020-03-16;9999.00\n<\/code><\/pre>\n<p>\nP\u00ebr modelin thjesht do t\u00eb fusim t\u00eb dh\u00ebnat tona t\u00eb testimit, por mbajm\u00eb mend\u2014 <code>COPY<\/code> m\u00eb efikas!<\/p>\n<pre><code class=\"sql\">INSERT INTO invoice_import\nVALUES\n  ('0123456789', 'Vasia', 'A-01', '2020-03-16', 1000.00)\n, ('9876543210', 'Petya', 'A-02', '2020-03-16', 666.00)\n, ('0123456789', 'Vasia', 'B-03', '2020-03-16', 9999.00);<\/code><\/pre>\n<p>\nS\u00eb pari, do t\u00eb nxjerrim ato 'segmentet', t\u00eb cilat referojn\u00eb 'faktet' tona. N\u00eb rastin ton\u00eb, faturat referojn\u00eb tek klient\u00ebt:<\/p>\n<pre><code class=\"sql\">CREATE TEMPORARY TABLE client_import AS\nSELECT DISTINCT ON(client_inn)\n-- mund t\u00eb p\u00ebrdorim thjesht SELECT DISTINCT, n\u00ebse t\u00eb dh\u00ebnat jan\u00eb e sigurt q\u00eb nuk jan\u00eb kontradiktore\n  client_inn inn\n, client_name \"name\"\nFROM\n  invoice_import;<\/code><\/pre>\n<p>\nP\u00ebr t\u00eb lidhur fatura me ID e klient\u00ebve, na duhet s\u00eb pari t'i njohim ose t'i gjenerojm\u00eb k\u00ebto identifikues. Ta shtojm\u00eb atyre fushat:<\/p>\n<pre><code class=\"sql\">ALTER TABLE invoice_import ADD COLUMN client_id integer;\nALTER TABLE client_import ADD COLUMN client_id integer;<\/code><\/pre>\n<p>\nDo t\u00eb shfryt\u00ebzojm\u00eb metod\u00ebn e p\u00ebrshkruar m\u00eb lart p\u00ebr sinkronizimin e tabelave me disa ndryshime - nuk do t\u00eb p\u00ebrdit\u00ebsojm\u00eb dhe hiqnim asgj\u00eb nga tabela e destinacionit, pasi importi i klient\u00ebve \u00ebsht\u00eb \"append-only\":<\/p>\n<pre><code class=\"sql\">-- vendosim n\u00eb tabel\u00ebn e importit ID-t\u00eb e regjistrimeve ekzistuese\nUPDATE\n  client_import T\nSET\n  client_id = D.client_id\nFROM\n  client D\nWHERE\n  T.inn = D.inn; -- \u00e7el\u00ebsi unik\n\n-- Shtojm\u00eb regjistrimet q\u00eb mungojn\u00eb dhe vendosim ID-t\u00eb e tyre\nWITH ins AS (\n  INSERT INTO client(\n    inn\n  , name\n  )\n  SELECT\n    inn\n  , name\n  FROM\n    client_import\n  WHERE\n    client_id IS NULL -- n\u00ebse ID nuk \u00ebsht\u00eb vendosur\n  RETURNING *\n)\nUPDATE\n  client_import T\nSET\n  client_id = D.client_id\nFROM\n  ins D\nWHERE\n  T.inn = D.inn; -- \u00e7el\u00ebsi unik\n\n-- vendosim ID-t\u00eb e klient\u00ebve p\u00ebr regjistrimet e faturave\nUPDATE\n  invoice_import T\nSET\n  client_id = D.client_id\nFROM\n  client_import D\nWHERE\n  T.client_inn = D.inn; -- \u00e7el\u00ebsi aplikativ\n<\/code><\/pre>\n<p>\nPra, gjith\u00e7ka - n\u00eb <code>invoice_import<\/code> tani kemi mbushur fush\u00ebn lidh\u00ebse <code>client_id<\/code>, me t\u00eb cil\u00ebn do t\u00eb vendosim fatur\u00ebn.<br \/>\n<br \/>Burimi: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/tensor\/blog\/492464\/\">habr.com<\/a> <\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u041f\u0440\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0440\u0430\u0437\u043d\u044b\u0435 ETL-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b: \u0438\u043c\u043f\u043e\u0440\u0442\u044b, \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c) \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u00ab\u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\u00bb, \u0438 \u0441\u0440\u0430\u0437\u0443 \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043e\u0431\u044a\u0435\u043c\u043d\u043e\u0435. \u0422\u0438\u043f\u043e\u0432\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u0437\u0432\u0443\u0447\u0438\u0442 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a: \u00ab\u0412\u043e\u0442 \u0442\u0443\u0442 \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0438\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u043b\u0430 \u0438\u0437 \u043a\u043b\u0438\u0435\u043d\u0442-\u0431\u0430\u043d\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0432\u0448\u0438\u0435 \u043e\u043f\u043b\u0430\u0442\u044b, \u043d\u0430\u0434\u043e \u0438\u0445 \u0431\u044b\u0441\u0442\u0440\u0435\u043d\u044c\u043a\u043e \u0432\u043a\u0430\u0447\u0430\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442 \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u043a \u0441\u0447\u0435\u0442\u0430\u043c\u00bb \u041d\u043e \u043a\u043e\u0433\u0434\u0430 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":74954,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-74953","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u041f\u0440\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0440\u0430\u0437\u043d\u044b\u0435 ETL-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b: \u0438\u043c\u043f\u043e\u0440\u0442\u044b, \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c) \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u00ab\u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\u00bb, \u0438 \u0441\u0440\u0430\u0437\u0443 \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043e\u0431\u044a\u0435\u043c\u043d\u043e\u0435. \u0422\u0438\u043f\u043e\u0432\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u0437\u0432\u0443\u0447\u0438\u0442 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a: \u00ab\u0412\u043e\u0442 \u0442\u0443\u0442 \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0438\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u043b\u0430 \u0438\u0437 \u043a\u043b\u0438\u0435\u043d\u0442-\u0431\u0430\u043d\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0432\u0448\u0438\u0435 \u043e\u043f\u043b\u0430\u0442\u044b, \u043d\u0430\u0434\u043e \u0438\u0445 \u0431\u044b\u0441\u0442\u0440\u0435\u043d\u044c\u043a\u043e \u0432\u043a\u0430\u0447\u0430\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442 \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u043a \u0441\u0447\u0435\u0442\u0430\u043c\u00bb \u041d\u043e \u043a\u043e\u0433\u0434\u0430\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/dba-gramotno-organizovyvaem-sinhronizaczii-i-importy\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"sq_AL\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47DBA: \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u044b | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u041f\u0440\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0440\u0430\u0437\u043d\u044b\u0435 ETL-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b: \u0438\u043c\u043f\u043e\u0440\u0442\u044b, \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c) \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u00ab\u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\u00bb, \u0438 \u0441\u0440\u0430\u0437\u0443 \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043e\u0431\u044a\u0435\u043c\u043d\u043e\u0435. \u0422\u0438\u043f\u043e\u0432\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u0437\u0432\u0443\u0447\u0438\u0442 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a: \u00ab\u0412\u043e\u0442 \u0442\u0443\u0442 \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0438\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u043b\u0430 \u0438\u0437 \u043a\u043b\u0438\u0435\u043d\u0442-\u0431\u0430\u043d\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0432\u0448\u0438\u0435 \u043e\u043f\u043b\u0430\u0442\u044b, \u043d\u0430\u0434\u043e \u0438\u0445 \u0431\u044b\u0441\u0442\u0440\u0435\u043d\u044c\u043a\u043e \u0432\u043a\u0430\u0447\u0430\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442 \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u043a \u0441\u0447\u0435\u0442\u0430\u043c\u00bb \u041d\u043e \u043a\u043e\u0433\u0434\u0430\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/dba-gramotno-organizovyvaem-sinhronizaczii-i-importy\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2020-03-22T05:42:22+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2020-03-22T05:42:22+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47DBA: organizojm\u00eb n\u00eb m\u00ebnyr\u00eb t\u00eb arsyeshme sinkronizimet dhe importet | ProHoster","description":"N\u00eb nj\u00eb p\u00ebrpunim t\u00eb komplikuar t\u00eb grupeve t\u00eb m\u00ebdha t\u00eb t\u00eb dh\u00ebnave (procese t\u00eb ndryshme ETL: importet, konvertimet dhe sinkronizimet me burime t\u00eb jashtme) shpesh lind nevoja p\u00ebr t\u00eb \"mbajtur mend\" di\u00e7ka p\u00ebrkoh\u00ebsisht dhe p\u00ebr ta p\u00ebrpunuar at\u00eb menj\u00ebher\u00eb shpejt. Detyra tipike e k\u00ebtij lloji zakonisht ting\u00ebllon si kjo: \"K\u00ebtu llogaria ka nxjerr\u00eb pagesat e fundit nga klient-banka, duhet t'i ngarkojm\u00eb shpejt n\u00eb sajt dhe t'i lidhim me faturat\". Por kur","canonical_url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/dba-gramotno-organizovyvaem-sinhronizaczii-i-importy","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"sq_AL","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47DBA: \u0433\u0440\u0430\u043c\u043e\u0442\u043d\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u044b | ProHoster","og:description":"\u041f\u0440\u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043d\u0430\u0431\u043e\u0440\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0440\u0430\u0437\u043d\u044b\u0435 ETL-\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u044b: \u0438\u043c\u043f\u043e\u0440\u0442\u044b, \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u043c) \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u00ab\u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c\u00bb, \u0438 \u0441\u0440\u0430\u0437\u0443 \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043e\u0431\u044a\u0435\u043c\u043d\u043e\u0435. \u0422\u0438\u043f\u043e\u0432\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430 \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0440\u043e\u0434\u0430 \u0437\u0432\u0443\u0447\u0438\u0442 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a: \u00ab\u0412\u043e\u0442 \u0442\u0443\u0442 \u0431\u0443\u0445\u0433\u0430\u043b\u0442\u0435\u0440\u0438\u044f \u0432\u044b\u0433\u0440\u0443\u0437\u0438\u043b\u0430 \u0438\u0437 \u043a\u043b\u0438\u0435\u043d\u0442-\u0431\u0430\u043d\u043a\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0432\u0448\u0438\u0435 \u043e\u043f\u043b\u0430\u0442\u044b, \u043d\u0430\u0434\u043e \u0438\u0445 \u0431\u044b\u0441\u0442\u0440\u0435\u043d\u044c\u043a\u043e \u0432\u043a\u0430\u0447\u0430\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442 \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u043a \u0441\u0447\u0435\u0442\u0430\u043c\u00bb \u041d\u043e \u043a\u043e\u0433\u0434\u0430","og:url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/dba-gramotno-organizovyvaem-sinhronizaczii-i-importy","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2020-03-22T05:42:22+00:00","article:modified_time":"2020-03-22T05:42:22+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"74953","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":null,"breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-02-28 18:04:26","updated":"2022-09-30 13:25:20"},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/74953","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/comments?post=74953"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/74953\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media\/74954"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media?parent=74953"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/categories?post=74953"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/tags?post=74953"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}