On Mon, 26 Apr 1999, Jules Bean wrote:
> "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
>
Yes, the query is not very usefull but i was only testing MySql. In case
you decide to reuse a query and you'll be using same or similar column
names but from different tables that the original query and in process of
amending the query, for example you forgot to delete a table that you'll
be not using in the new query. This means that ervery time you make such
mistake the problem will occur.
My Streams table also has over 15000 records and as you have explained
"MN" would mean 15000x15000. But I did not think that this query would
display anything from the Streams table. ???
No idea what is happening?
Ajdin, Thanx