Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
Razorbx13
Post Patron
Post Patron

Database Locks

Hi all, I have seen other posts here but am having an issue that does not appear to be explained in these posts.  So when I import new data is a lock occurring on the source database by PowerBI?  I am wondering because when I am importing records from a timekeeping system I will be reading records at a fast clip, but when someone goes and enters time my import slows to a halt, shows as suspended and the table gets locked.  Then after a few or several minutes, it starts flying again.  I will go from loading 15K records a second to 5 records a second.  We have a call into the software vendor as well, but I do not know why this would be occurring.  Any assistance would be helpful.  TIA.

1 ACCEPTED SOLUTION
v-luwang-msft
Community Support
Community Support

Hi @Razorbx13 ,

I test it ,when I import data.

vluwangmsft_0-1631005337595.png

And I use the following to query if the table is locking in the sqlserver.

select   request_session_id   spid,OBJECT_NAME(resource_associated_entity_id) tableName   
from   sys.dm_tran_locks where resource_type='OBJECT'

Retrun me blank.

vluwangmsft_1-1631005409327.png

So in my opinion, when exporting, there is no lock, you can use the above query statement to query the lock process when you import slowly.Generally, locking a table only occurs when there are additions, deletions, and changes to the table.

View locked tables:

select   request_session_id   spid,OBJECT_NAME(resource_associated_entity_id) tableName   
from   sys.dm_tran_locks where resource_type='OBJECT'

spid   lock  Process
tableName   Locked Table Name

Unlocked:

declare @spid  int 
Set @spid  = 57  --Lock table process
declare @sql varchar(1000)
set @sql='kill '+cast(@spid  as varchar)
exec(@sql)

Does Select query Lock the table

 

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

View solution in original post

2 REPLIES 2
v-luwang-msft
Community Support
Community Support

Hi @Razorbx13 ,

I test it ,when I import data.

vluwangmsft_0-1631005337595.png

And I use the following to query if the table is locking in the sqlserver.

select   request_session_id   spid,OBJECT_NAME(resource_associated_entity_id) tableName   
from   sys.dm_tran_locks where resource_type='OBJECT'

Retrun me blank.

vluwangmsft_1-1631005409327.png

So in my opinion, when exporting, there is no lock, you can use the above query statement to query the lock process when you import slowly.Generally, locking a table only occurs when there are additions, deletions, and changes to the table.

View locked tables:

select   request_session_id   spid,OBJECT_NAME(resource_associated_entity_id) tableName   
from   sys.dm_tran_locks where resource_type='OBJECT'

spid   lock  Process
tableName   Locked Table Name

Unlocked:

declare @spid  int 
Set @spid  = 57  --Lock table process
declare @sql varchar(1000)
set @sql='kill '+cast(@spid  as varchar)
exec(@sql)

Does Select query Lock the table

 

 

Did I answer your question? Mark my post as a solution!


Best Regards

Lucien

lbendlin
Super User
Super User

That is indeed a question for the software vendor.  I think the lock is generated during the write operation (as it should be, frankly)  and Power BI is the victim here, not the culprit.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

Check out the February 2024 Power BI update to learn about new features.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.