database-concurrency

How To Minimize Likelihood of Database Contention During Update

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-03 21:04:25
问题 I have written some PostgreSQL database client code to update a central database with a table of IP addresses and host names from multiple clients. There are two tables: one to hold mappings between IP addresses and host names, and one to hold a queue of IP addresses that have not yet been resolved to host names. Here is the IP-address-to-host-name mapping table: CREATE TABLE g_hostmap( appliance_id INTEGER, ip INET, fqdn TEXT, resolve_time TIMESTAMP, expire_time TIMESTAMP, UNIQUE(appliance

Azure database concurrent usage issues

让人想犯罪 __ 提交于 2019-12-31 13:30:14
问题 Just wanted to run this by you all to see if there are any bright ideas as I have exhausted all of my ideas after an entire day, night and morning of searching. The issues we’re encountering invariably centre around database connectivity when under concurrent usage (selenium test), e.g. timeouts, dropped/closed connections, database server unreachable. The issue does seem to be restricted to Azure as we’re yet to encounter the issue locally even when running the same selenium test on the same

Hibernate (JPA): how to handle StaleObjectStateException when several object has been modified and commited

笑着哭i 提交于 2019-12-19 09:00:44
问题 Consider the scenario: A Db transaction envolving more than one row from different tables with versioning. For example: A shopLists and products. Where a shopList may contain products (with their amount in the shoplist) and products have their current stock. When I insert ou edit a shopList, I want the stock of those products in the shopList to be updated to keep the stock consistant. To do that, I open a transaction, insert/update the shopList, update the stocks for each product (apply delta

Database operation expected to affect 1 row(s) but actually affected 50(db sequence next number) row(s)

梦想的初衷 提交于 2019-12-11 14:39:20
问题 I use entity framework 2.2.6. I have AddOrUpdate method. When client try to operate(insert or update) on entity I check if entity exist on db by unique values and I set old data id value to new data id value and I set it as updated. If not exist I set it as insert public void AddOrUpdate(TEntity entity, Expression<Func<TEntity, bool>> predicate) { var oldEntity = Get(predicate); DetachEntry(oldEntity); if (oldEntity != null) { var idProperty = entity.GetType().GetProperties().First(x => x

What's the best way to manage concurrency in a database access application?

爷,独闯天下 提交于 2019-12-04 19:09:30
问题 A while ago, I wrote an application used by multiple users to handle trades creation. I haven't done development for some time now, and I can't remember how I managed the concurrency between the users. Thus, I'm seeking some advice in terms of design. The original application had the following characteristics: One heavy client per user. A single database. Access to the database for each user to insert/update/delete trades. A grid in the application reflecting the trades table. That grid being

What's the best way to manage concurrency in a database access application?

有些话、适合烂在心里 提交于 2019-12-03 12:35:32
A while ago, I wrote an application used by multiple users to handle trades creation. I haven't done development for some time now, and I can't remember how I managed the concurrency between the users. Thus, I'm seeking some advice in terms of design. The original application had the following characteristics: One heavy client per user. A single database. Access to the database for each user to insert/update/delete trades. A grid in the application reflecting the trades table. That grid being updated each time someone changes a deal. I am using WPF. Here's what I'm wondering: Am I correct in

Hibernate (JPA): how to handle StaleObjectStateException when several object has been modified and commited

心已入冬 提交于 2019-12-01 06:41:04
Consider the scenario: A Db transaction envolving more than one row from different tables with versioning. For example: A shopLists and products. Where a shopList may contain products (with their amount in the shoplist) and products have their current stock. When I insert ou edit a shopList, I want the stock of those products in the shopList to be updated to keep the stock consistant. To do that, I open a transaction, insert/update the shopList, update the stocks for each product (apply delta) and then commit the transaction. No big deal up to now. However, other user may have updated one or

Amazon DynamoDB Conditional Writes and Atomic Counters

落花浮王杯 提交于 2019-11-30 03:00:56
问题 The application im working on currently requires me to increment an attribute belonging to an item in DynamoDB many times in a 20 to 30 minute period. I've been doing some additional reading about DynamoDBs conditional writes and atomic counters Atomic Counters in dynamo seems like a logical choice for what I need but I do worry about the consistency of the data especially across a distributed database like dynamo and issues accuracy of my data. I'm expecting the API to get hammered at peak

Does PostgreSQL run some performance optimizations for read-only transactions

筅森魡賤 提交于 2019-11-29 03:37:17
According to the reference documentation the READ ONLY transaction flag is useful other than allowing DEFERRABLE transactions? SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY; The DEFERRABLE transaction property has no effect unless the transaction is also SERIALIZABLE and READ ONLY. When all three of these properties are selected for a transaction, the transaction may block when first acquiring its snapshot, after which it is able to run without the normal overhead of a SERIALIZABLE transaction and without any risk of contributing to or being canceled by a serialization failure. This

Does PostgreSQL run some performance optimizations for read-only transactions

狂风中的少年 提交于 2019-11-27 15:59:19
问题 According to the reference documentation the READ ONLY transaction flag is useful other than allowing DEFERRABLE transactions? SET SESSION CHARACTERISTICS AS TRANSACTION READ ONLY; The DEFERRABLE transaction property has no effect unless the transaction is also SERIALIZABLE and READ ONLY. When all three of these properties are selected for a transaction, the transaction may block when first acquiring its snapshot, after which it is able to run without the normal overhead of a SERIALIZABLE