473,769 Members | 3,923 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using NOLOCK cause Cartesian joins


Hi,



When we use WITH (NOLOCK) at the end of table list in a SELECT query, a
Cartesian join is returned (i.e. approximately 6,500 records instead of
57, which is distressing.



We are building a database-agnostic system; while I believe PostgreSQL
is using a multiversion locking model and does not need WITH (NOLOCK),
our application also must run against MS SQL Server and that uses a
concurrency control locking model. We are using PostgreSQL 7.3.2 on
RedHat 7.2.



Any suggestions?



Thanks in advance,

Roger

*************** *************** *************** *************** *************** *******

Privileged or Confidential Information may be contained within this message..
If you have received this message in error, you are kindly requested to destroy
it immediately and inform the sender by return. You are prohibited from using
or forwarding the contents in any way whatsoever.
Opinions carried within this message that run contrary to the official business
of Emojo are solely the individual opinions of the sender, and are not sanctioned
or endorsed by the company.

*************** *************** *************** *************** *************** *******

############### ############### ############### ############### #####
This e-mail message has been scanned for Viruses and Content
and cleared by Trend Micro InterScan
############### ############### ############### ############### #####
Nov 12 '05 #1
2 7202

"Roger Gordon" <Ro***@emojo.co m> writes:
When we use WITH (NOLOCK) at the end of table list in a SELECT query, a
Cartesian join is returned (i.e. approximately 6,500 records instead of
57, which is distressing.


You'll have to post an actual query and output, preferably with an "explain
analyze" before anyone can help much. I certainly don't see this problem.

--
greg
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #2
On Wed, 12 Nov 2003, Roger Gordon wrote:
When we use WITH (NOLOCK) at the end of table list in a SELECT query, a
Cartesian join is returned (i.e. approximately 6,500 records instead of
57, which is distressing.


I'm guessing you mean something like:
select *
from table1, table2 WITH (NOLOCK)
where table1.foo=tabl e2.bar;
?

If so, it should be giving you a notice like:
adding missing FROM-clause entry for table "table2"
because you've aliased table2 as the name WITH and the first column
of said table as NOLOCK (if I'm remembering the details correctly)
so table2 isn't in scope in the where clause.

As far as we can tell a query like the above is technically illegal in
SQL but 7.3 and earlier will always add an extra entry as if you had
done from table1, table2 WITH (NOLOCK), table2. 7.4 has an option to
instead error.
---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postg resql.org so that your
message can get through to the mailing list cleanly

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
14884
by: Eddie | last post by:
I wondering which one of the following I should use to get the best performance. 1. "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED" OR 2. "WITH (NOLOCK)" I notice that when I use the #1 "SET TRANSACTION..." it sets a lock Mode type of "Sch-S" (Schema stability Lock) which described by SQL Books Online as "Schema stability (Sch-S) locks do not block any transactional locks, including exclusive (X) locks"
6
8524
by: laurenq uantrell | last post by:
Is it possible to use With (NOLOCK) and With (READPAST) in the same SELECT query and what whould be the syntax? @param int SELECT myRow FROM dbo.myTable WITH (NOLOCK) WHERE
5
2565
by: Ã…smund Kveim Lie | last post by:
Hi, We have found a possible bug in 7.3.1. It seems that using CROSS JOIN and doing plain Cartesian product, listing to tables in the from clause, gives different results. According to the documentation this should be equivalent. The following example should explain the problem: CREATE TABLE a (a1 text, a2 text); CREATE TABLE b (b1 text, b2 text); CREATE TABLE c (a1 text, b1 text, c1 text);
5
4335
by: Ilan Sebba | last post by:
When it comes to adding records in related tables, Access is really smart. But when I try to do the same using ADO, I am really stupid. Say I have two parent tables (eg Course, Student) and one child table (StudentProgress). The course progress records how a student progresses on a course. I have one course (History) and one student called Maya. I now want to record her grade (64). If I do this in Access using a form, then the form...
7
3100
by: Eric Slan | last post by:
Hello All: I'm having a problem that's been baffling me for a few days and I seek counsel here. I have an Access 2000 DB from which I want to run several reports. These reports are essentially the same (albeit for minor formatting differences). To produce these reports, I am drawing from three tables:
4
3560
by: John Smith | last post by:
Isn't life a bitch! You know what you want but you don't know how to get it. I have produced 12 queries that calculate a payment profile over 12 months. For a number of the records (ie with the same product id)there are likely to be more than one payment recorded. Nonetheless, when I run the queries individually and the query relates to a table that provides referential integrity through a one to many relationship, the query does what...
5
1524
by: serge | last post by:
Is it generally or almost always better to have multiple small SPs and functions to return a result set instead of using a single big 1000+ lines SP? I have one SP for example that is 1000+ lines and early analysis of the SP I see it first has 3 big blocks of code separated by IF statements. Then within each IF block of code I see 3-4 UNIONs. UNIONs that means they are all returning the same columns so I am guessing these are prime...
44
4192
by: Christoph Zwerschke | last post by:
In Python, it is possible to multiply a string with a number: >>> "hello"*3 'hellohellohello' However, you can't multiply a string with another string: >>> 'hello'*'world' Traceback (most recent call last): File "<interactive input>", line 1, in ?
5
2931
by: bmm | last post by:
I have a Store Procedure on a Sql Server 2000 Where I use the Table Hint "NoLock" on all selects. One of my clients (OleDbConnection from C#) doesn't get the same Result Set as the others. The result Set should have 31 rows but this client only gets 5! When I remove all the "NoLocks" everything works fine. How can that be?
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5309
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.