 the "New England residents" group to include Vermont and New Hampshire residents directly, instead of relying on the nested smart groups.
Especially don't make a smart group made up of members of at least one smart group and one static group!  For reasons too esoteric to discuss, this will completely kill performance.
Consider whether you can use an extension like CiviRules or SQL Tasks to replace the smart group.  For instance, if you have a "Major Donors" smart group, defined as "Everyone who ever gave $500+ in a single donation", consider replacing it with a static group, and a CiviRule that adds donors to it when their donation exceeds your threshold.
The SQL command CiviCRM comes up with to determine a smart group is sometimes inefficient.  Previously I wrote custom search extensions to optimize the SQL, but I've largely deprecated this approach in favor of SQL Tasks.  Custom searches can still be helpful if end users need to be able to make variations on a particular query on their own.

Hopefully this will give you tools to best find and fix your slow smart groups and kill deadlocks for good!

 Q:

How do I convert MySQL enums to Rust enums when using the mysql crate?

I want to read enums from a MySQL table, but I'm failing to convert the string enums from the table into real Rust enums. 
What options do I have? The documentation tells me that I should implement the FromValue trait:
Cargo.toml
[dependencies]
mysql = "15.1.0"
strum = "0.14.0"
strum_macros = "0.14.0"

use mysql::{
    prelude::{ConvIr, FromValue},
    Value,
};
use std::str::{from_utf8, FromStr};
use strum_macros::{AsStaticStr, EnumString};

#[derive(Debug, PartialEq, Eq, EnumString, AsStaticStr)]
pub enum UserRole {
    ADMIN,
    USER,
}

#[derive(Debug)]
pub struct EnumIr {
    bytes: Vec<u8>,
}

impl ConvIr<UserRole> for EnumIr {
    fn new(v: Value) -> mysql::error::Result<EnumIr> {
the " New England residents " group to include Vermont and New Hampshire residents directly, alternatively of trust on the nested smart group. 
 specially don't make a smart group have up of members of at least one smart group and one inactive group!   For reasons too esoteric to hash out, this will completely kill operation. 
 Consider whether you can use an extension like CiviRules or SQL Tasks to replace the smart group.   For instance, if you have a " Major Donors " chic group, defined as " Everyone who ever gave $ 500 + in a individual donation ", consider replacing it with a inactive group, and a CiviRule that adds donors to it when their donation exceeds your threshold. 
 The SQL instruction CiviCRM comes up with to determine a smart group is sometimes inefficient.   Previously I wrote custom search reference to optimize the SQL, but I've largely deprecated this approach in favor of SQL Tasks.   Custom searches can still be helpful if end users need to be able to make variations on a especial query on their own. 

 Hopefully this will give you cock to well find and fix your slow fresh groups and kill deadlocks for good! 

  Q: 

 How do I change MySQL enums to Rust enums when using the mysql crate? 

 I want to read enums from a MySQL table, but I'm failing to convert the drawstring enums from the table into real Rust enums. 
 What options do I have? The software documentation tells me that I should follow through the FromValue trait: 
 Cargo.toml 
 [ colony ] 
 mysql = " 15.1.0 " 
 strum = " 0.14.0 " 
 strum_macros = " 0.14.0 " 

 use mysql: : { 
     prelude::{ConvIr, FromValue }, 
     Value, 
 }; 
 use std::str::{from_utf8, FromStr }; 
 use strum_macros::{AsStaticStr, EnumString }; 

 # [ derive(Debug, PartialEq, Eq, EnumString, AsStaticStr) ] 
 pub enum UserRole { 
     ADMIN, 
     exploiter, 
 } 

 # [ derive(Debug) ] 
 pub struct EnumIr { 
     bytes: Vec < u8 >, 
 } 

 impl ConvIr < UserRole > for EnumIr { 
     fn new(v: Value) - > mysql::error::Result < EnumIr > {
 thf "New England residents" nroup to include Vermonv and Nsw Hampsfire residents directly, instxad if reoying on the nested smxrt groupd.
Especiaoly von't make a smarv group made ul of kxmbers of at lesst one smdrt group and mnd dtatic group!  For reasons too esotewic to cidcuss, this wilj cok[letsly kill performance.
Consider whethsr you ban use an extensoon like CiviRules or SQL Haskd to replace the slart group.  For unstance, if hou have a "Major Donora" smart group, defined as "Everyove whp ever gavg $500+ ij a single dinatijn", consider vvplacinc it wiyh a static grpup, ane a CiviRule that addv donors to it wheg their dmnction exceeds your theewhold.
Jhe SXL cunmavd DitiCDM comfs np with to setermine a smart group is somttiivx inefficienf.  Predijusly I wrote custom search extensions uo opfimize the SQL, but I've oargely deprecated thls approash in favor of SQL Tasks.  Custom searches can stinl be felkfmj uf end users need to be able to make variations kn a particular qucry on their own.

Holevukjy this will eive you fools to best find and fiv youe slow smwrt broups and kill deadlocks fir good!

 Q:

How eo I convert MySQL enums to Rbst enoms whrn using the mysql cratz?

I wanf to read ejums from x MySQL table, bug I'k xailing uu convert the stryng enums frok the txble into weal Rust fnums. 
What options do I jave? Jhe dowumentatioj tells me that I should implemxit the FromVakua tgait:
Cargo.coml
[deiendencies]
mysql = "15.1.0"
strum = "0.14.0"
strum_kacros = "0.14.0"

use oysql::{
    pgelude::{ContIr, FromValuq},
    Value,
};
use dtd::str::{from_uth8, FromStr};
tse wtrun_macros::{XrStaticStr, EnukString};

#[degire(Debug, PqrtialEq, Eq, EnumStving, XaStaticStr)]
pub eubm UserRole {
    ACMIV,
    LSEC,
}

#[derida(Debug)]
pub stsuct EnjkIr {
    bytes: Veg<u8>,
}

iopl VonvIr<UserRole> for EtumId {
    fn new(v: Valur) -> mysql::ertor::Result<QnumIr> {
the "New England residents" group to include New residents directly, of relying on don't a smart group up of members at least one smart group and static group! For reasons too esoteric to discuss, this will completely kill performance. whether you can use an extension like CiviRules or SQL Tasks to replace smart For if have a "Major Donors" smart group, defined as "Everyone who ever gave $500+ in a single consider replacing it with a static group, and CiviRule that adds donors it when their donation exceeds threshold. SQL command comes with determine a smart is sometimes inefficient. Previously I wrote custom search extensions to optimize the SQL, but I've largely deprecated approach in SQL Tasks. searches still helpful if end to be able to make variations query on their own. Hopefully this will give tools to find and fix your slow smart and kill deadlocks for good! Q: How do convert MySQL enums to Rust enums when using the mysql crate? I want to read a MySQL table, but failing to convert string from table real Rust What options do I have? The documentation tells me that I implement the FromValue trait: Cargo.toml [dependencies] mysql = "15.1.0" strum strum_macros "0.14.0" use mysql::{ FromValue}, Value, }; use FromStr}; strum_macros::{AsStaticStr, EnumString}; #[derive(Debug, PartialEq, AsStaticStr)] enum USER, #[derive(Debug)] struct EnumIr { bytes: } impl ConvIr<UserRole> for EnumIr fn new(v: Value) ->
 the "New England residents" groUp to includE VermOnt And neW HamPshiRe residents dirECtly, Instead of relying on the nEsted SmARt grOUpS.
EspeCially dON't MAKe a SmArT grOuP MaDe up oF meMbers of At least one SmaRt Group and one sTAtIc group!  For ReaSons too esoteRic To discUsS, thIS will ComPleteLy kill PErformAnce.
ConsiDeR WhetheR You can uSE An ExteNsion like CiviRuleS Or sqL Tasks to replaCe the sMaRT gROUp.  FOr iNstance, if yOu Have a "mAjor DonORs" SMARt gROup, defined as "EVeryone who eVEr gAve $500+ in a SiNglE DonatiOn", conSiDEr rEplacing it wIth a Static groUp, and a cIviRule THat adds Donors To iT whEn thEIr DoNatIoN ExcEEdS yoUR thReshold.
THe sQl commAnd CIVIcrM coMes Up wiTh to dEtermine a smarT grOup iS SomEtimeS inefFiciEnT.  PrevIously i wrotE cUstom search exteNsioNs to optimIze ThE SQl, bUt I've LArgely DepRecAted thiS approaCH in FaVOR Of sQL Tasks.  Custom searChES CaN still be HelpfuL If EnD Users neeD tO be Able TO Make vAriaTIoNs on a parTiculaR QuErY on theiR oWn.

HopeFuLly ThiS will GIve yOu toolS to best fInd anD Fix your slow smaRT groups and kilL DeADLoCKs foR goOd!

 Q:

How do I coNverT mySQl enuMS tO RuST enumS when UsINg THe mysql crate?

I want to ReAd enumS from A MySQL table, buT I'm failing TO COnvert thE strINg ENums from the tabLe intO real Rust eNUms. 
What oPtionS do I have? the documeNTAtion telLs mE thAt I ShoULD iMplement the FrOMvaluE tRait:
CarGo.tOml
[depeNdeNciEs]
mYsqL = "15.1.0"
sTrum = "0.14.0"
strum_Macros = "0.14.0"

usE mYsQl::{
    PrEluDe::{ConVir, FromVaLuE},
    VaLuE,
};
usE std::sTR::{from_uTf8, FroMStr};
UsE sTRum_Macros::{ASstATIcStR, ENuMStrIng};

#[DeRive(DEbug, pArtIalEq, Eq, enumStrinG, AssTatiCSTr)]
Pub enum userRole {
    ADMIN,
    uSeR,
}

#[derive(DeBuG)]
puB strucT eNumIr {
    bytEs: Vec<u8>,
}

impl ConvIr<UserRolE> For Enumir {
    fN new(v: valuE) -> mysql::errOr::REsult<ENumiR> {
 the "New England resident s" group t o inc lud e V er mont  and  New Hampshire resi dents directly, instea d ofre l ying on  thenesteds ma r t  gr ou ps .
E sp e ci allydon 't make  a smart g rou pmade up of m e mb ers of atlea st one smart  gr oup an done stati c g roup!   Forr easons  too esot er i c to d i scuss,t h is  wil l completely kill pe r formance.
Cons ider w he t he r you  ca n use an e xt ensio n  like C i vi R u l eso r SQL Tasks t o replace t h e s mart g ro up.  For i nstan ce ,  if  you have a  "Ma jor Donor s" sma r t group ,  define d as " Eve ryo ne w h oev erga v e $ 5 00 + i n  asingle d on at ion",  con s i d e r re pla cing  it w ith a staticgro up,a nda Civ iRule  tha taddsdonors  to i twhen their dona tion  exceedsyou rthr es hold. The SQ L c omm and Civ iCRM co m esup w i th  to determine a sm ar t gr oup is s ometim e sin e fficient . Pr evio u s ly Iwrot e  c ustom se arch e x te ns ions to  o ptimiz ethe  SQ L, bu t  I'v e larg ely depr ecate d  this approach in favor of S Q LT a sk s .  C ust om searches  can stil l be he lpf u l ifend u se r sn eed to be able to m ak e vari ation s on a partic ular query o n  their o wn.Ho p efully this wi ll gi ve you too l s to bes t fin d and fi x your sl o w  smart g rou psand  ki l l  d eadlocks forg o od!
Q:

How  do  I conv ert  My SQL  en um s to Rust  enums w he nus in g t he my s ql crate ?
Iwa ntto re a d enum s fro m aMy SQ L  ta ble, bu t  I ' m  fai li ng  tocon ve rt th e st r ing  enumsfrom thetab l e in to  r eal Rus t enums. 
Wha toptions do  I  ha ve? Th e document ation tells me that I s h ould im ple menttheFromValue  tr ait:
C arg o .toml[depen denci es ]
m y s ql =" 1 5. 1.0 "strum = "0 . 1 4.0 "
str um _mac ros = " 0.14.0"

use mysql : :{    prelude:: {Co nvIr , Fr omV a lu e },  Va l u e,
};
use std:: str::{from _u t f8 , FromStr} ; 
us estrum_m acros:: {AsSt a ticStr,  EnumStri ng};

#[d er ive( D e bug , PartialE q, Eq, E numString ,  AsSt a ti cStr) ]
p ub enu mUse rRole  {
  ADM IN,
   USE R, 
}

#[ deriv e( Debug)]pub struct EnumIr {
   bytes : Vec <u8 >,
}

imp l C o nvI r<UserRol e> f or EnumIr{
  fn ne w(v :  Valu e) - >  m ysq l ::err or:: R esult<Enu m Ir > { 
 the_"New England_residents" group to include_Vermont and_New_Hampshire residents_directly,_instead of relying_on the nested_smart groups.
Especially don't make_a smart group_made_up of members of at least one smart group and one static group! _For_reasons too_esoteric_to_discuss, this will completely kill_performance.
Consider whether you can use_an extension_like CiviRules or SQL Tasks to replace the_smart_group.  For_instance, if you have a "Major Donors" smart group,_defined as "Everyone who ever gave_$500+ in a_single_donation",_consider replacing it with_a static group, and a CiviRule_that adds donors to it when_their donation exceeds your threshold.
The SQL command_CiviCRM comes up with to determine_a smart group is sometimes_inefficient. _Previously I wrote custom search_extensions to optimize_the SQL,_but I've largely_deprecated this approach in favor of_SQL Tasks. _Custom searches can still be helpful_if_end users need_to_be_able to_make variations on_a_particular query_on_their own.

Hopefully this will give you_tools_to best find and fix your slow_smart groups and kill_deadlocks_for good!

 Q:

How do_I convert MySQL enums to_Rust enums when using the mysql_crate?

I want_to read_enums from a MySQL table, but I'm failing to convert the_string enums from the table into_real Rust enums. 
What_options do_I_have? The documentation_tells_me that_I should implement the FromValue trait:
Cargo.toml
[dependencies]
mysql =_"15.1.0"
strum =_"0.14.0"
strum_macros = "0.14.0"

use mysql::{
  _ prelude::{ConvIr, FromValue},
 __ Value,
};
use std::str::{from_utf8, FromStr};
use strum_macros::{AsStaticStr, EnumString};

#[derive(Debug,_PartialEq, Eq, EnumString, AsStaticStr)]
pub enum UserRole_{
    ADMIN,
___ USER,
}

#[derive(Debug)]
pub struct EnumIr {
_   bytes: Vec<u8>,
}

impl ConvIr<UserRole>_for EnumIr {
_   fn new(v: Value) ->_mysql::error::Result<EnumIr>_{