Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

PostgreSQL: Transazioni e locking

2,068 views

Published on

Slides www.pgtraining.com su PostgresSQL: transazioni e locking

Published in: Education
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

PostgreSQL: Transazioni e locking

  1. 1. Transazioni e concorrenza Cenni su Transazioni e concorrenza 27/11/08 /home/scotty/enrico/corso­web/finale/Architettura/arch3.odp page 1
  2. 2. Transazioni e concorrenza Definizione di transazione Effetti della concorrenza sulle transazioni Livelli di isolamento delle transazioni MVCC – Multi version concurrency control overview Differenze tra MVCC e locking Row level Locking 27/11/08 /home/scotty/enrico/corso­web/finale/Architettura/arch3.odp page 2
  3. 3. Cos'è una transazione E' un insieme di istruzioni che deve essere eseguita  in maniera atomica → o tutto o niente Una transazione deve essere ACID Atomicity  :  atomicità,  la  transazione  è  indivisibile  nella  sua  esecuzione e la sua esecuzione deve essere o totale o nulla, non  sono ammesse esecuzioni intermedie; Consistency  :  coerenza,  quando  inizia  una  transazione  il  database si trova in uno stato coerente e quando la transazione  termina  il  database  deve  essere  in  uno  stato  coerente,  ovvero  non deve violare eventuali vincoli di integrità, quindi non devono  verificarsi contraddizioni (inconsistency) tra i dati archiviati nel DB Isolation, isolamento, ogni transazione deve essere eseguita in  modo  isolato  e  indipendente  dalle  altre  transazioni,  l'eventuale  fallimento  di  una  transazione  non  deve  interferire  con  le  altre  transazioni in esecuzione Durability:  persistenza,  dopo  un  commit  work,  i  cambiamenti  apportati non dovranno essere più persi.  27/11/08 /home/scotty/enrico/corso­web/finale/Architettura/arch3.odp page 3
  4. 4. I livelli di isolamento Sono  richiesti  quattro  livelli  di  isolamento  delle  transazioni  per  prevenire  questi  tre  comportamenti  indesiderabili  Dirty  read:  una  transazione  legge  i  dati  provenienti  da  una  transazione  simultanea uncomitted Non  repeatable  read:  una  transazione  rilegge  i  dati  che  ha  precendentemente  letto  e  trova  che  i  dati  sono  stati  modificati da un'altra  transazione che ha eseguito il commit dal momento della lettura iniziale phantom  read:  una  transazione  riesegue  una  query  che  restituisce  un  insieme  di  righe  che  soddisfano  la  condizione  di  ricerca  e  trova  che  l'insieme delle righe che soddisfano questa condizione è cambiato a causa  di un'altra transazione che ha eseguito un commit di recente 27/11/08 /home/scotty/enrico/corso­web/finale/Architettura/arch3.odp page 4
  5. 5. I livelli di isolamento Isolation level Dirty Read Non repeatable read Phantom Read Read Uncommitted Possible Possible Possible Read Committed Not Possible Possible Possible Repeatable Read Not Possible Not Possible Possible Serializable Not Possible Not Possible Not Possible 27/11/08 /home/scotty/enrico/corso­web/finale/Architettura/arch3.odp page 5
  6. 6. I livelli di isolamento PostgreSQL possiede solo 2 livelli di isolamento :  Read comitted, Serializable Read commited:  E' il livello di isolamento di default Postgresql  vede  i  dati  che  hanno  avuto  un  commit  prima  che la transazione partisse. La  query  però  può  vedere  gli  effetti  di  aggiornamenti  avvenuti  all'interno  della  stessa  transazioni  che  non  possono essere visti da query al di fuori della transazione. Le transazioni non restano in attesa Serializable: le transazioni avvengono una di seguito all'altra,  come se fossero in sequenza   27/11/08 /home/scotty/enrico/corso­web/finale/Architettura/arch3.odp page 6
  7. 7. I livelli di isolamento Dove si cambiano i livelli di isolamento? File postgresql.conf 27/11/08 /home/scotty/enrico/corso­web/finale/Architettura/arch3.odp page 7
  8. 8. Locking ­ un esempio Begin work; lock table testtb; Transazione 1 ......... Select * from testtb; Transazione 2 27/11/08 /home/scotty/enrico/corso­web/finale/Architettura/arch3.odp page 8
  9. 9. Locking ­ un esempio Istante Istante Tempo Tempo Transazione  Transazione  T1 T2 27/11/08 /home/scotty/enrico/corso­web/finale/Architettura/arch3.odp page 9
  10. 10. Locking un esempio Output Transazione 2 In attesa della fine del lock 27/11/08 /home/scotty/enrico/corso­web/finale/Architettura/arch3.odp page 10
  11. 11. Locking ­ un esempio Commit work; Transazione 1 Dati dalla Transazione T2 27/11/08 /home/scotty/enrico/corso­web/finale/Architettura/arch3.odp page 11
  12. 12. Locking ­ un esempio Facciamo un esempio Pratico? 27/11/08 /home/scotty/enrico/corso­web/finale/Architettura/arch3.odp page 12
  13. 13. Differenze MVCC ­ Locking Nel modello MVCC i lock messi dal sistema durante  le operazioni di scrittura non bloccano le operazioni  di  lettura  e  viceversa  come  avviene  invece  nei  meccanismi di lock tradizionale Esistono dei sistemi di locking più raffinato? Si  :  ad  esempio  select  ...  for  update  o  select  ...  for  share  che  metteno  un lock  sulla singola riga  che  viene  modificata,  ed  esegue  un  locking  a  livello di ROW 27/11/08 /home/scotty/enrico/corso­web/finale/Architettura/arch3.odp page 13
  14. 14. Punto della situazione Abbiamo parlato di  Definizione di transazione Effetti della concorrenza sulle transazioni Livelli di isolamento delle transazioni MVCC – Multi version concurrency control  overview Differenze tra MVCC e locking Row level Locking 27/11/08 /home/scotty/enrico/corso­web/finale/Architettura/arch3.odp page 14

×