SQL server with (nolock)

View: New views
2 Messages — Rating Filter:   Alert me  

SQL server with (nolock)

by Leen Toelen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I am performing a query on a large table (80GB), which is occasionaly terminated by the server with a query timeout. The errot is always caused by another query running at the same time. The solution is to use 'with (nolock)' in the query, since I don't need locking in this situation. I tried to enable this using eclipselink using query hints, but never saw the 'with (nolock)' appear in the queries. Does anybody know how to use 'with (nolock)' in SQL server (using jTDS) and eclipselink.

Regards,
Leen

_______________________________________________
eclipselink-users mailing list
eclipselink-users@...
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

Re: SQL server with (nolock)

by James Sutherland :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

A native SQL query would be you best solution.

If you set the pessimistic lock query hint, EclipseLink will use "WITH (UPDLOCK)", if that is sufficient.


Leen Toelen wrote:
Hi,

I am performing a query on a large table (80GB), which is occasionaly
terminated by the server with a query timeout. The errot is always caused by
another query running at the same time. The solution is to use 'with
(nolock)' in the query, since I don't need locking in this situation. I
tried to enable this using eclipselink using query hints, but never saw the
'with (nolock)' appear in the queries. Does anybody know how to use 'with
(nolock)' in SQL server (using jTDS) and eclipselink.

Regards,
Leen