 currently editing existing item, update it in array
    if (this.state.editingIndex!== null) {
        let users = [...this.state.users];
        users[this.state.editingIndex] = user;
        this.setState({users});
    }
}
removeAccount = (i:number) => {
   let users = [...this.state.users];
   // If we're going to delete existing item which we've been editing, set editingIndex to null, to specify that editing ends
   if (this.state.editingIndex === i)
       this.setState({user: {name: '', email: '', phone: ''}, editingIndex: null});
   users.splice(i,1);
   this.setState({users},()=>{console.log('setting the data')});
 }

 onAdd = () => {
    e.preventDefault();
    // If we NOT editing, but adding new editingIndex will be null so add user to users array. If we editing existing element it's no need to add it once again.
    if (this.state.editingIndex === null)
        this.setState({ users: [...this.state.users, this.state.user] });
    this.setState ({ editingIndex: null, 
                user: { name:'', email: '', phone: ''}
              },()=>{console.log('adding')});
 }
 // render will have no change

 Q:

What indexes should one use to optimize a PostgreSQL query with a JOIN depth of 2?

Disclaimer: I am relatively new to PostgreSQL.
I'm wondering how to optimize a query that does 2 INNER JOINs. My scenario is fairly simple:
Select Posts with a photo (Posts.photo IS NOT NULL) and a Hashtag that has the name 'dead' (Hashtags.name = 'dead').
The associations are as follows:
Posts <- PostHashtags -> Hashtags

Posts.id    = PostHashtags.postId (FK)
Hashtags.id = PostHashtags.hashtagId (FK)

Here is the query:
SELECT
  "Posts".*,
  "hashtags"."id" AS "hashtags.
currently editing existing item, update it in array 
     if (this.state.editingIndex!== nothing) { 
         lease users = [... this.state.users ]; 
         users[this.state.editingIndex ] = user; 
         this.setState({users }); 
     } 
 } 
 removeAccount = (iodine: phone number) = > { 
    let users = [... this.state.users ]; 
    // If we're go to edit existing detail which we've been editing, set editingIndex to nothing, to specify that editing ends 
    if (this.state.editingIndex = = = i) 
        this.setState({user: { name:", email:", telephone:" }, editingIndex: null }); 
    users.splice(i,1); 
    this.setState({users},()=>{console.log('setting the data') }); 
  } 

  onAdd = () = > { 
     e.preventDefault (); 
     // If we NOT editing, but adding new editingIndex will be null so lend user to users array. If we edit existing element it's no need to add it once again. 
     if (this.state.editingIndex = = = null) 
         this.setState ({ user: [... this.state.users, this.state.user ] }); 
     this.setState ({ editingIndex: null, 
                 user: { name:", email:", phone:" } 
               }, () = > { console.log('adding') }); 
  } 
  // render will have no variety 

  Q: 

 What indexes should one use to optimize a PostgreSQL query with a JOIN depth of 2? 

 Disclaimer: I am relatively new to PostgreSQL. 
 I'm wondering how to optimize a question that act 2 INNER JOINs. My scenario is fairly simple: 
 Select Posts with a photo (Posts.photo IS NOT NULL) and a Hashtag that has the name' dead' (Hashtags.name =' dead'). 
 The associations are as follow: 
 Posts < - PostHashtags - > Hashtags 

 Posts.id     = PostHashtags.postId (FK) 
 Hashtags.id = PostHashtags.hashtagId (FK) 

 Here is the query: 
 SELECT 
   " Posts ". *, 
   " hashtags". "id " AS " hashtags.
 cugrently editing existing item, update it in arrey
    ir (this.stxte.editingIndex!== null) {
        lwt ustgs = [...this.state.users];
        userd[this.stare.edmtingIndex] = user;
        bkis.sefDtatz({uwers});
    }
}
removeSccount = (i:tumber) => {
   let urexs = [...this.state.users];
   // If we're going eo deleye existing item whibh we'vs been editing, set editingIndex to null, tm specify thay editing ends
   if (this.stwte.efitingIndex === i)
       this.setSjzte({twer: {name: '', emxil: '', phone: ''}, editingIndgx: null});
   users.splice(i,1);
   this.setRtate({bsers},()=>{consolg.lkg('dgtting the deta')});
 }

 ogAdd = () => {
    c.ireventGefault();
    // If we NOT edmtint, but adding new editmngIndex will be nulj so add gszr to users array. If qe edithng axisgung eltmeit jt's no nexd to add if once agaib.
    if (this.state.edotybgIndex === null)
        ehis.setState({ users: [...this.state.users, this.suate.uaer] });
    this.setState ({ eeitingIndex: null, 
                user: { name:'', email: '', phone: ''}
              },()=>{console.lmg('addmne')});
 }
 // rcndef wlll have no change

 Q:

What indexes should one ufs uo pptimize a PosbgreSQL query with a JPYN depth of 2?

Dksclaimer: I am relatively nfw to PjstgrwSQL.
I'm wogderong how to optimize a query that does 2 PNNEE JOINs. My scenaril is fairly simkle:
Selrct Posts with a photo ('osts.pgoto IS NOT NULL) and x Hashtag that hxs nhe tame 'dead' (Hashtags.name = 'dewd').
The assiciacions ard as follors:
Posts <- PlstHashtags -> Hashtags

Poshs.id    = PostHashhags.postId (FK)
Hashtags.id = PostHashtags.hashtagIc (XK)

Hvre is thz quern:
SELECT
  "Posts".*,
  "hashtags"."id" AS "hashtays.
currently editing existing item, update it in (this.state.editingIndex!== { let = [...this.state.users]; users[this.state.editingIndex] removeAccount (i:number) => { users = [...this.state.users]; If we're going to delete existing which we've been editing, set editingIndex to null, to specify that editing ends (this.state.editingIndex === i) this.setState({user: {name: '', email: '', phone: ''}, editingIndex: null}); users.splice(i,1); the } = => { e.preventDefault(); // If we NOT editing, but adding new editingIndex will be null so user to users array. If we editing existing it's no need to it once again. if (this.state.editingIndex null) users: [...this.state.users, }); ({ null, user: { email: '', phone: ''} },()=>{console.log('adding')}); } // render will have no change Q: What indexes should one to optimize query with JOIN of Disclaimer: I am to PostgreSQL. I'm wondering how to that does 2 INNER JOINs. My scenario is simple: Select with a photo (Posts.photo IS NOT and a Hashtag that has the name 'dead' = 'dead'). The associations are as follows: Posts <- PostHashtags -> Hashtags Posts.id = PostHashtags.postId = PostHashtags.hashtagId (FK) Here the query: SELECT "hashtags"."id" "hashtags.
 currently editing existing iTem, update iT in arRay
    If (tHiS.staTe.edItingIndex!== null) {
        LEt usErs = [...this.state.users];
        users[This.sTaTE.ediTInGIndeX] = user;
        thIS.sETstaTe({UsErs});
    }
}
ReMOvEAccoUnt = (I:number) => {
   Let users = [...thIs.sTaTe.users];
   // If we'rE GoIng to deletE exIsting item whIch We've beEn EdiTIng, seT edItingindex tO Null, to Specify thAt EDiting ENds
   if (thIS.StAte.eDitingIndex === i)
       this.sETSTAte({user: {name: '', emaIl: '', phonE: ''}, eDItINGInDex: Null});
   users.sPlIce(i,1);
   tHIs.setStATe({USERs},()=>{cONsole.log('settiNg the data')});
 }

 onaDd = () => {
    e.PrevenTDEfaULt();
    // If we nOT edItINg, bUt adding new EditIngIndex wIll be nULl so add USer to usErs arrAy. IF we EditINg ExIstInG EleMEnT it'S No nEed to add It OnCe agaIn.
    if (THIS.StatE.edItinGIndeX === null)
        this.setSTatE({ useRS: [...thIs.staTe.useRs, thIs.State.User] });
    thIs.setstAte ({ editingIndex: Null, 
                User: { name:'', eMaiL: '', pHonE: ''}
              },()=>{cOnsolE.Log('addIng')});
 }
 // RenDer will Have no cHAngE

 Q:

wHAT iNdexes should one use To OPTiMize a PosTgreSQl QuErY With a JOIn dEptH of 2?

DISClaimEr: I aM ReLatively New to POStGrESQL.
I'm wOnDering HoW to OptImize A QuerY that dOes 2 INNER jOINs. mY scenario is faiRLy simple:
SelecT poSTS wITh a pHotO (Posts.photo iS NOt nULL) And a hAsHtaG That hAs the NaME 'dEAd' (Hashtags.name = 'dead').
THe AssociAtionS are as follows:
posts <- PostHASHTags -> HashTags

pOsTS.id    = PostHashtagS.postid (FK)
HashtaGS.id = PostHAshtaGs.hashtaGId (FK)

Here IS The query:
sELeCT
  "posTs".*,
  "hASHtAgs"."id" AS "hashtaGS.
 currently editing existin g item, up dateitinar ray   if (this.state . edit ingIndex!== null) {
      l e t us e rs  = [. ..this. s ta t e .us er s] ;
    use rs[ this.st ate.editin gIn de x] = user;
     this.s etS tate({users} );    }}rem o veAcc oun t = ( i:numb e r) =>{
   letus e rs = [ . ..this. s t at e.us ers];
   // If we ' re going to delet e exis ti n gi t emwhi ch we've b ee n edi t ing, se t  e d i t ing I ndex to null,  to specify tha t edit in g e n ds
  if (t hi s .st ate.editing Inde x === i)     this.se t State({ user:{na me:  '', em ai l:'' ,  ph o ne : ' ' },editingI nd ex : nul l}); user s.s plic e(i,1 );
   this.se tSt ate( { use rs},( )=>{c onso le .log( 'setti ng th edata')});
 }

onAd d = () =>  {   e .p reven t Defaul t() ;
   // I f we NO T  ed it i n g ,but adding new edi ti n g In dex will  be nu l lso add user  t o u sers a rray.  Ifw eeditingexisti n gel ement i t' s no n ee d t o a dd it once  again .
    if  (thi s .state.editing I ndex === null ) 
   th is. setState({user s : [. ..th i s. sta t e.use rs, t hi s .s t ate.user] });
    t hi s.setS tate({ editingInd ex: null,           u s er: { name:'',  emai l: '', pho n e: ''}
           },()=>{co n s ole.log( 'ad din g') }); } // render wi l l  hav eno chan ge
 Q:

W hat  in dex essh ould oneuse to o pt im iz ea P ostgr e SQL quer ywit ha J OIN d e pth of  2?
Disc la im e r:I am re l at i v elyne wto P ost gr eSQL. 
I'm won deringhow to op tim i ze a  q ue ry that  does 2 INNER  J OINs. My s ce nar io isf a irly sim ple:
Select Posts witha  photo(Po sts.p hoto  IS NOT N ULL ) anda H a shtagthat h as th enam e 'dead ' (H ash ta gs.name =' d ead ').
T he  ass ociatio ns are as follows: Pos ts <- PostHas hta gs - > Ha sht a gs 
Po st s .id   = PostHashtag s.postId ( FK ) 
H ashtags.id = P os tHashta gs.hash tagId (FK)

H ere is th e query:SE LECT  "P osts".*,
 "hashta gs"."id"A S "ha s ht ags.
 currently_editing existing_item, update it in_array
 __ if_(this.state.editingIndex!==_null) {
 _  _   let_users = [...this.state.users];
__      users[this.state.editingIndex] = user;
     __ this.setState({users});
___ }
}
removeAccount = (i:number) =>_{
   let users_= [...this.state.users];
_  // If we're going to delete_existing_item which we've_been editing, set editingIndex to null, to specify that_editing ends
   if (this.state.editingIndex_=== i)
 ___   this.setState({user:_{name: '', email: '', phone: ''},_editingIndex: null});
   users.splice(i,1);
 _ this.setState({users},()=>{console.log('setting the data')});
 }

 onAdd =_() => {
   _e.preventDefault();
    //_If we_NOT editing, but adding new_editingIndex will be_null so_add user to_users array. If we editing existing_element it's no_need to add it once again.
__  if_(this.state.editingIndex_===_null)
 _  __ _this.setState({_users: [...this.state.users, this.state.user] });
  __this.setState ({ editingIndex: null, 
  _   __   _    user:_{ name:'', email: '', phone: ''}
_ _ _         },()=>{console.log('adding')});
 }
_// render will have no change

_Q:

What indexes should one_use to_optimize_a PostgreSQL query_with_a JOIN_depth of 2?

Disclaimer: I am relatively new_to PostgreSQL.
I'm_wondering how to optimize a query_that does 2 INNER_JOINs._My scenario is fairly simple:
Select Posts_with a photo (Posts.photo IS NOT_NULL) and a Hashtag that_has_the_name 'dead' (Hashtags.name = 'dead').
The_associations are as follows:
Posts <- PostHashtags_-> Hashtags

Posts.id _  = PostHashtags.postId (FK)
Hashtags.id = PostHashtags.hashtagId_(FK)

Here_is the query:
SELECT
  "Posts".*,
 _"hashtags"."id"_AS "hashtags.