List:General Discussion« Previous MessageNext Message »
From:Jules Bean Date:April 26 1999 1:05pm
Subject:Re: Problem executing query, a bug perhaps?
View as plain text  
"A. Brandic" wrote:
> 
> Hi!
> 
> I've got a problem with MySql and I'm not sure if it is a bug or my
> fault.  I'm running MySql 3.22.21
> on Alpha 800 with Unix 4.0 on it and MySql was installed as Binary version.
> 
> I've created three test tables each containing just over 15000 records in
> 14 columns.
> If I do a simple query such as :
> mysql> select Universe.Surname from Universe, TestTable where
>          -> ID=AdmissionNo;
> 
> ID is unique for TestTable and it is integer(9) Primary Key and
> auto_increment  and
> AdmissionNo  is unique for Universe and it is integer(9) Primary Key and
> auto_increment as well.
> 
> This executes in 1.05 secs with no probs.
> 
> But when I do a similar query:
> mysql> select Universe.Surname from Universe, TestTable, Streams where
>          -> ID=AdmissionNo;
> 
> Still ID and AdmissionNo are Unique for their tables and do not appear in
> any other table but this time
> I've inserted Streams table which is not used at all.
> Well this time after 2min the following is displayed
> 
> mysql: Out of memory (Needed 8160 bytes)
> ERROR 2008: MySQL client run out of memory
> 
> and also it disconnects me from the database that I was usinq and I have
> to logi in again.

Well, I find the error message confusing.  But I can explain the
problem...

Your query wasn't useful.  Adding a table to a select, and not
specifying any conditions, will do a cartesian product.  So if your
original query returns N rows, and your Streams table has M rows, then
this is going to return MN rows.

Which could be a very big number..

Jules

-- 
/----------------+-------------------------------+---------------------\
|  Jelibean aka  | jules@stripped         |  6 Evelyn Rd        |
|  Jules aka     |                               |  Richmond, Surrey   |
|  Julian Bean   | jmlb2@stripped        |  TW9 2TF *UK*       |
+----------------+-------------------------------+---------------------+
|  War doesn't demonstrate who's right... just who's left.             |
|  When privacy is outlawed... only the outlaws have privacy.          |
\----------------------------------------------------------------------/
Thread
Question: how to count unique rows in multiple tables?Kelly Yancey22 Apr
Re: Question: how to count unique rows in multiple tables?Tomislav Petrovic23 Apr
  • Problem executing query, a bug perhaps?A. Brandic26 Apr
    • Re: Problem executing query, a bug perhaps?Jules Bean26 Apr
      • Re: Problem executing query, a bug perhaps?A. Brandic26 Apr
      • Re: Problem executing query, a bug perhaps?A. Brandic26 Apr
        • Re: Problem executing query, a bug perhaps?Jules Bean26 Apr
    • Re: Problem executing query, a bug perhaps?Sasha Pachev26 Apr