Professional Web Applications Themes

SELECT... FOR UPDATE - MySQL

Hello, I use the SELECT ... FOR UPDATE to lock some records. If another transaction starts to modify the same records locked it stands until it can execute or a dead lock error is raised. I don't want to wait for locks to be released but I want the exception being raised immediately, is it possible? thanks Marco...

  1. #1

    Default SELECT... FOR UPDATE

    Hello,
    I use the SELECT ... FOR UPDATE to lock some records. If another
    transaction starts to modify the same records locked it stands until it
    can execute or a dead lock error is raised. I don't want to wait for
    locks to be released but I want the exception being raised immediately,
    is it possible?

    thanks

    Marco
    Marco Guest

  2. #2

    Default Re: SELECT... FOR UPDATE

    Marco wrote: 
    a couple of things:
    1- what database engine are you using
    2-what isolation level are you using

    you can find number 2 in your config or ini file.

    --
    lark -- net
    To reply to me directly, delete "despam".
    lark Guest

  3. #3

    Default Re: SELECT... FOR UPDATE

    lark ha scritto: 
    > a couple of things:
    > 1- what database engine are you using[/ref]
    INNODB 
    readcommitted, but I have tried to switch to others too (repeateble,
    serialize). 
    Marco Guest

  4. #4

    Default Re: SELECT... FOR UPDATE

    == Quote from Marco (it)'s article 
    > > a couple of things:
    > > 1- what database engine are you using[/ref]
    > INNODB 
    > readcommitted, but I have tried to switch to others too (repeateble,
    > serialize). [/ref]

    maybe try to set a different isolation level at session or even transaction level:

    SET SESSION TRANSACTION ISOLATION LEVEL isolation_level;
    SET TRANSACTION ISOLATION LEVEL isolation_level;

    and see how the results can be different.

    if this fails, you may have to write some stored procedures to do this for your
    and raise exceptions based on your own criteria.
    --
    POST BY: lark with PHP News Reader
    lark Guest

Similar Threads

  1. UPDATE and SELECT MAX
    By amygdala in forum MySQL
    Replies: 15
    Last Post: May 1st, 03:31 AM
  2. a SELECT FOR UPDATE question
    By Tim in forum PostgreSQL / PGSQL
    Replies: 10
    Last Post: February 10th, 03:30 PM
  3. Update from a select
    By Bob Bedford in forum PHP Development
    Replies: 1
    Last Post: January 15th, 10:14 PM
  4. update from select
    By Gary Stainburn in forum PERL Beginners
    Replies: 2
    Last Post: October 29th, 04:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139