Group  } from '@angular/forms';
@Component({
  selector:'my-app',
  templateUrl: './app.component.html',
  styleUrls: [ './app.component.css' ]
})
export class AppComponent  {
  usersForm: FormGroup;
  constructor(private formBuilder: FormBuilder){
    this.usersForm = this.formBuilder.group({
    users: this.formBuilder.array([
        this.createUserRow()
      ])
    });
  }
  get userControls(){
    return  (this.usersForm.get('users') as FormArray).controls
  }

  get value(){
   return this.usersForm.getRawValue();
  }

  createUserRow(){
    return this.formBuilder.group({
      firstName: [null],
      lastName:[null],
      contact:[null],
      email:[null]
    })
  }

  addNew(){
     (this.usersForm.get('users') as FormArray).controls.push(this.createUserRow());
  }
}

Hope this helps :)

 Q:

Postgres slow query (slow index scan)

I have a table with 3 million rows and 1.3GB in size. Running Postgres 9.3 on my laptop with 4GB RAM. 
explain analyze
select act_owner_id from cnt_contacts where act_owner_id = 2

I have btree key on cnt_contacts.act_owner_id defined as:
CREATE INDEX cnt_contacts_idx_act_owner_id 
   ON public.cnt_contacts USING btree (act_owner_id, status_id);

The query runs in about 5 seconds

Bitmap Heap Scan on cnt_contacts  (cost=2598.79..86290.73 rows=6208 width=4) (actual time=5865.617..5875.302 rows=5444 loops=1)
  Recheck Cond: (act_owner_id = 2)
  ->  Bitmap Index Scan on cnt_contacts_idx_act_owner_id  (cost=0.00..2597.24 rows=6208 width=0
Group   } from' @angular / forms'; 
 @Component ({ 
   selector:'my - app', 
   templateUrl:' ./app.component.html', 
   styleUrls: [' ./app.component.css' ] 
 }) 
 export class AppComponent   { 
   usersForm: FormGroup; 
   constructor(private formBuilder: FormBuilder) { 
     this.usersForm = this.formBuilder.group ({ 
     users: this.formBuilder.array ([ 
         this.createUserRow () 
       ]) 
     }); 
   } 
   get userControls () { 
     hark back   (this.usersForm.get('users') as FormArray).controls 
   } 

   get value () { 
    recurrence this.usersForm.getRawValue (); 
   } 

   createUserRow () { 
     return this.formBuilder.group ({ 
       firstName: [ null ], 
       lastName:[null ], 
       contact:[null ], 
       email:[null ] 
     }) 
   } 

   addNew () { 
      (this.usersForm.get('users') as FormArray).controls.push(this.createUserRow ()); 
   } 
 } 

 Hope this helps :) 

  Q: 

 Postgres slow question (slow index scan) 

 I have a mesa with 3 million rows and 1.3 GB in size. Running Postgres 9.3 on my laptop with 4 GB RAM. 
 excuse analyze 
 choice act_owner_id from cnt_contacts where act_owner_id = 2 

 I have btree keystone on cnt_contacts.act_owner_id defined as: 
 CREATE INDEX cnt_contacts_idx_act_owner_id 
    ON public.cnt_contacts use btree (act_owner_id, status_id); 

 The query function in approximately 5 moment 

 Bitmap Heap Scan on cnt_contacts   (cost=2598.79.. 86290.73 rows=6208 width=4) (actual time=5865.617.. 5875.302 rows=5444 loops=1) 
   Recheck Cond: (act_owner_id = 2) 
   - >   Bitmap Index Scan on cnt_contacts_idx_act_owner_id   (cost=0.00.. 2597.24 rows=6208 width=0
Grokp  } from '@angular/forms';
@Cooponent({
  selector:'my-app',
  tempmateUrl: './xpp.component.html',
  styleUrls: [ './app.comkjnent.css' ]
})
export clxss AppColponent  {
  uwwrsForm: FocjGroup;
  constdmctor('rmvate formBuildgr: FormBuildar){
    this.uservFurl = this.formBuilder.group({
    users: thys.formBiipder.array([
        tnys.crsateUserRow()
      ])
    });
  }
  get userCkntrols(){
    return  (tnis.usersForm.get('users') as FogmArgay).controls
  }

  get value(){
   rejhrn rhis.usersForo.getRawVallz();
  }

  createOserRow(){
    return this.formBuildef.grou'({
      firsjUqme: [tull],
      lestNamv:[null],
      coknact:[nuln],
      rmail:[null]
    })
  }

  eddNww(){
     (this.usersForm.gxt('users') as FormArray).sontrols.pgsk(this.createUserRow());
  }
}

Hipw thiv henps :)

 W:

Portgdex alow qkerb (slow indes scan)

I havw a table with 3 milkijb rows and 1.3GB in sise. Running Postgres 9.3 on my laptop with 4GB RAJ. 
explain analyze
select act_owner_id from cnt_clntacts wrere act_owner_id = 2

I have btree key on cnt_contacts.awt_ownxr_kd bcninea ad:
CREATE INDEX cnt_contacts_idx_act_owner_id 
   ON [hbkib.cnt_contacts USINN btree (act_owner_id, shayos_id);

The query tuns in abkut 5 seconds

Bitmap Heap Ssan ob cnt_contwcts  (cost=2598.79..86290.73 rows=6208 width=4) (actual tine=5865.617..5875.302 rows=5444 loopf=1)
  Recheck Cond: (act_lwner_id = 2)
  ->  Bijmap Imdex Scan on cnt_contactr_idx_zct_owner_id  (cost=0.00..2597.24 rowa=6208 width=0
Group } from '@angular/forms'; @Component({ selector:'my-app', templateUrl: [ ] }) class AppComponent { this.usersForm this.formBuilder.group({ users: this.formBuilder.array([ ]) }); } userControls(){ return (this.usersForm.get('users') as FormArray).controls } value(){ return this.usersForm.getRawValue(); } createUserRow(){ return this.formBuilder.group({ firstName: [null], lastName:[null], contact:[null], email:[null] }) addNew(){ (this.usersForm.get('users') as FormArray).controls.push(this.createUserRow()); } } Hope this helps :) Q: Postgres slow (slow scan) have table with 3 million rows and 1.3GB in size. Running Postgres 9.3 on my laptop with RAM. explain analyze select act_owner_id from cnt_contacts where = 2 I have key on cnt_contacts.act_owner_id defined as: INDEX ON public.cnt_contacts btree status_id); query runs in 5 seconds Bitmap Heap Scan on cnt_contacts (cost=2598.79..86290.73 rows=6208 width=4) (actual time=5865.617..5875.302 rows=5444 loops=1) Recheck Cond: (act_owner_id 2) -> Scan on (cost=0.00..2597.24 width=0
Group  } from '@angular/forms';
@CompOnent({
  selecTor:'my-App',
  TemPlAteURl: './apP.component.html',
  STyleurls: [ './app.component.css' ]
})
expOrt clAsS appCOMpOnent  {
  UsersFoRM: FORMGrOuP;
  cOnsTrUCtOr(priVatE formBuIlder: FormBUilDeR){
    this.usersFoRM = tHis.formBuiLdeR.group({
    users: tHis.FormBuIlDer.ARray([
        tHis.CreatEUserROW()
      ])
    });
  }
  get usErControlS(){
    rETurn  (thIS.usersFORM.gEt('usErs') as FormArray).conTRoLS
  }

  get value(){
   returN this.uSeRSFORM.geTRaWValue();
  }

  creaTeuserROW(){
    return THiS.FORmBUIlder.group({
      firStName: [null],
      lAStNAme:[nulL],
      cOntACt:[null],
      Email:[NuLL]
    })
  }

  adDNew(){
     (this.useRsFoRm.get('userS') as ForMarray).coNTrols.puSh(this.CreAteuserrOw());
  }
}

hoPe tHiS HelPS :)

 Q:

posTGreS slow queRy (SlOw indEx scAN)

i HAve a TabLe wiTh 3 milLion rows and 1.3GB In sIze. RUNniNg PosTgres 9.3 On my LaPtop wIth 4GB RaM. 
expLaIn analyze
select Act_oWner_id froM cnT_cOntAcTs wheRE act_owNer_Id = 2

I Have btrEe key on CNt_cOnTACTs.Act_owner_id defined aS:
CreaTe INDEX cnT_contaCTs_IdX_Act_owner_Id 
   oN pUbliC.CNt_conTactS uSiNG btree (Act_ownER_iD, sTatus_id);

thE query RuNs iN abOut 5 seCOnds

bitmap heap Scan On cnt_COntacts  (cost=2598.79..86290.73 rowS=6208 Width=4) (actual tiME=5865.617..5875.302 rOWS=5444 lOOps=1)
  REchEck Cond: (act_oWner_ID = 2)
  ->  BitMap INDeX ScAN on cnT_contAcTS_iDX_act_owner_id  (cost=0.00..2597.24 rows=6208 WiDth=0
Group  } from '@angular/fo rms';
@Com ponen t({ 
 se lect or:' my-app',
  tem p late Url: './app.component. html' , sty l eU rls:[ './ap p .c o m pon en t. css '] 
} )
exp ort  classAppCompone nt { 
  usersForm :  F ormGroup;  c onstructor(p riv ate fo rm Bui l der:For mBuil der){   thi s.usersFo rm = this . formBui l d er .gro up({
    users: t h is . formBuilder.ar ray([   th is. createUser Ro w()
    ]) } ) ;
}
  get userC ontrols(){  return  (th i s.user sForm .g e t(' users') asForm Array).co ntrols   }

 g et valu e(){
  r etu rn t h is .u ser sF o rm. g et Raw V alu e();
  } 
 creat eUse r R o w (){   ret urn t his.formBuild er. grou p ({     firs tNam e:  [nul l],
     l as tName:[null],
    contact: [nu ll ],     e m ail:[n ull ]
   })
 }

  a d dNe w( ) {     (this.usersForm .g e t (' users')as For m Ar ra y ).contro ls .pu sh(t h i s.cre ateU s er Row());  }
}Ho pe  this h el ps :)
Q:
Po stgre s  slo w quer y (slowindex scan)

I havea  table with 3 mi l l io n  row s a nd 1.3GB in  siz e . Ru nnin g  P ost g res 9 .3 on  m y  l a ptop with 4GB RAM.
e xplain  anal yze
select ac t_owner_id f r om cnt_c onta c ts where act_owne r_id= 2

I hav e  btree k ey on  cnt_con tacts.act _ o wner_iddef ine d a s:C R EA TE INDEX cnt_ c o ntac ts _idx_ac t_o wner_id  
  O N p ubl ic .cnt_cont acts USI NG  b tr ee  (a ct_ow n er_id, s ta tus _i d); 

The queryrunsin a bo ut 5 s econdsBi t m ap H ea pScan  on  c nt_co ntac t s (cost=2 598.79..8 629 0 .73ro ws =6208 w idth=4) (actu al  time=5865 .6 17. .5875. 3 0 2 rows=5 444 loops=1)
  RecheckC ond: (a ct_ owner _id= 2)
  ->   B itmapInd e x Scan  on cn t_con ta cts _ i dx_ac t _ ow ner _i d  (cost=0 . 0 0.. 2597. 24  row s=6208width=0
Group _} from_'@angular/forms';
@Component({
  selector:'my-app',
 _templateUrl: './app.component.html',
__styleUrls: [_'./app.component.css'_]
})
export class AppComponent_ {
 _usersForm: FormGroup;
  constructor(private_formBuilder: FormBuilder){
 __ this.usersForm = this.formBuilder.group({
    users: this.formBuilder.array([
     __ this.createUserRow()
___   ])
 _  });
  }
_ get_userControls(){
    return  (this.usersForm.get('users') as_FormArray).controls
_ }

 _get value(){
   return this.usersForm.getRawValue();
  }

 _createUserRow(){
    return this.formBuilder.group({
_  ___firstName: [null],
  _   lastName:[null],
  _   contact:[null],
  _   email:[null]
   _})
  }

  addNew(){
 _   (this.usersForm.get('users') as_FormArray).controls.push(this.createUserRow());
 _}
}

Hope this helps :)

 Q:

Postgres_slow query (slow_index scan)

I_have a table_with 3 million rows and 1.3GB_in size. Running_Postgres 9.3 on my laptop with_4GB_RAM. 
explain analyze
select_act_owner_id_from_cnt_contacts where_act_owner_id = 2

I_have_btree key_on_cnt_contacts.act_owner_id defined as:
CREATE INDEX cnt_contacts_idx_act_owner_id 
__ ON public.cnt_contacts USING btree (act_owner_id, status_id);

The_query runs in about_5_seconds

Bitmap Heap Scan on_cnt_contacts  (cost=2598.79..86290.73 rows=6208 width=4)_(actual time=5865.617..5875.302 rows=5444 loops=1)
  Recheck_Cond: (act_owner_id_= 2)
_ ->  Bitmap Index Scan on cnt_contacts_idx_act_owner_id  (cost=0.00..2597.24 rows=6208_width=0