| | |
Querys Bug
Please support our MySQL advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jun 2008
Posts: 3
Reputation:
Solved Threads: 0
Good day 
<<== new, please excuse If I post shit
I've one query which doesn't work:
This query doesn't work .... mysql server has gone away is the return or nothing... just loading
I've located the problem with a second query which works:
As you can see the both query have only 1 different INNER JOIN (ignore the additional where-condition):
This line is "crashing" MySQl... but why ????
Structures of the tables:
I hope you can help me, thanks !!
dispy

<<== new, please excuse If I post shit

I've one query which doesn't work:
MySQL Syntax (Toggle Plain Text)
SELECT conquer.TIMESTAMP AS TIME, conquer.new_owner AS new_owner_id FROM de12_conquer AS conquer INNER JOIN de12_tribe AS conqueror ON conqueror.id=conquer.new_owner INNER JOIN de12_tribe AS loser ON loser.id=conquer.old_owner WHERE (conquer.timestamp>0 && conquer.timestamp<1213647029734) AND (conqueror.ally=37038 OR loser.ally=37038 ) ORDER BY conquer.TIMESTAMP DESC LIMIT 50
This query doesn't work .... mysql server has gone away is the return or nothing... just loading

I've located the problem with a second query which works:
MySQL Syntax (Toggle Plain Text)
SELECT conquer.TIMESTAMP AS TIME, conquer.new_owner AS new_owner_id FROM de12_conquer AS conquer INNER JOIN de12_tribe AS conqueror ON conqueror.id=conquer.new_owner WHERE (conquer.timestamp>0 && conquer.timestamp<1213647029734) AND (conqueror.ally=37038 ) ORDER BY conquer.TIMESTAMP DESC LIMIT 50
As you can see the both query have only 1 different INNER JOIN (ignore the additional where-condition):
MySQL Syntax (Toggle Plain Text)
INNER JOIN de12_tribe AS loser ON loser.id=conquer.old_owner
This line is "crashing" MySQl... but why ????
Structures of the tables:
MySQL Syntax (Toggle Plain Text)
CREATE TABLE IF NOT EXISTS `de12_tribe` ( `id` INT(11) NOT NULL, `name` VARCHAR(50) NOT NULL DEFAULT '', `ally` INT(11) NOT NULL, `villages` INT(5) NOT NULL, `points` INT(11) NOT NULL, `rank` INT(5) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
MySQL Syntax (Toggle Plain Text)
CREATE TABLE IF NOT EXISTS `de12_conquer` ( `villageid` INT(11) NOT NULL, `TIMESTAMP` INT(11) NOT NULL, `new_owner` INT(11) NOT NULL, `old_owner` INT(11) NOT NULL, KEY `villageid` (`villageid`), KEY `TIMESTAMP` (`TIMESTAMP`), KEY `new_owner` (`new_owner`), KEY `old_owner` (`old_owner`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
I hope you can help me, thanks !!
dispy
Last edited by dispy; Jun 23rd, 2008 at 3:46 pm.
•
•
Join Date: Apr 2008
Posts: 296
Reputation:
Solved Threads: 42
Hi
What exactly do you mean by:
"This query doesn't work .... mysql server has gone away is the return or nothing... just loading" ?
Do you get any error message?
Does the query never ends?
Is the result set empty? (because of improper data you want to join together. for example: if old_owner of table del2_conquer and id of del2_tribe do not have same values, your result set would be empty.)
How large are both tables, current number of rows per table? Depending on size and features needed sometimes innodb is more useful than myisam.
Second table does not have primary key, also no foreign keys (sorry, fk not possible for myisam). I am trying to figure out which relationship exists between both tables, and I have got the feeling that the table's structure wouldn't that be optimal. As for example villages of del2_tribe could appear several times for same tribe. On the other hand there is villageid of second table, how is it related to first table (via villages)?
ok, maybe above will get you some ideas to proceed solving your problem.
krs,
tesu
What exactly do you mean by:
"This query doesn't work .... mysql server has gone away is the return or nothing... just loading" ?
Do you get any error message?
Does the query never ends?
Is the result set empty? (because of improper data you want to join together. for example: if old_owner of table del2_conquer and id of del2_tribe do not have same values, your result set would be empty.)
How large are both tables, current number of rows per table? Depending on size and features needed sometimes innodb is more useful than myisam.
Second table does not have primary key, also no foreign keys (sorry, fk not possible for myisam). I am trying to figure out which relationship exists between both tables, and I have got the feeling that the table's structure wouldn't that be optimal. As for example villages of del2_tribe could appear several times for same tribe. On the other hand there is villageid of second table, how is it related to first table (via villages)?
ok, maybe above will get you some ideas to proceed solving your problem.
krs,
tesu
•
•
Join Date: Jun 2008
Posts: 79
Reputation:
Solved Threads: 8
if you run a explain on your query it shows
"Impossible WHERE noticed after reading const tables"
that's because
[code] WHERE conquer.timestamp between 0 and 1213647029734 [\code]
In table de12_conquer ,timestamp columns is a integer data type and this number cant be inserted into it
The value you are using (1213647029734) is worng,it not a UNIXTIME or a timestamp value
let me know if it helps....
"Impossible WHERE noticed after reading const tables"
that's because
[code] WHERE conquer.timestamp between 0 and 1213647029734 [\code]
In table de12_conquer ,timestamp columns is a integer data type and this number cant be inserted into it
The value you are using (1213647029734) is worng,it not a UNIXTIME or a timestamp value
let me know if it helps....
•
•
Join Date: Jun 2008
Posts: 3
Reputation:
Solved Threads: 0
•
•
•
•
"This query doesn't work .... mysql server has gone away is the return or nothing... just loading" ?
Do you get any error message?
Does the query never ends?
•
•
•
•
Is the result set empty? (because of improper data you want to join together. for example: if old_owner of table del2_conquer and id of del2_tribe do not have same values, your result set would be empty.)
I've tried LEFT JOIN instead of INNER JOIN -that didn't work too.
•
•
•
•
Second table does not have primary key, also no foreign keys (sorry, fk not possible for myisam). I am trying to figure out which relationship exists between both tables, and I have got the feeling that the table's structure wouldn't that be optimal. As for example villages of del2_tribe could appear several times for same tribe. On the other hand there is villageid of second table, how is it related to first table (via villages)?
de12_tribe contains the tribe -there is a primary key cause the id of every player exists only one time.
A tribe can have multiple conquers logged in the table de12_conquer - new_owner and old_owner are the fields which contain the id of the tribe ( one the looser and one the winner).
It's for a tool for the browsergame tribalwars (to understand the relations ).
the villageid contains the ID (primary key) of the village (in de12_villages- for this problem not necessary).
Don't worry about the structure of the relations -they're correct

•
•
•
•
f you run a explain on your query it shows
"Impossible WHERE noticed after reading const tables"
that's because
[code] WHERE conquer.timestamp between 0 and 1213647029734 [\code]
Here the explain-output:
MySQL Syntax (Toggle Plain Text)
id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE loser ALL PRIMARY NULL NULL NULL 7616 USING temporary; USING filesort 1 SIMPLE conquer ref TIMESTAMP,new_owner,old_owner old_owner 4 dispy.loser.id 8 USING WHERE 1 SIMPLE conqueror ALL PRIMARY NULL NULL NULL 7616 Range checked for each record (index map: 0x1)
•
•
•
•
In table de12_conquer ,timestamp columns is a integer data type and this number cant be inserted into it
The value you are using (1213647029734) is worng,it not a UNIXTIME or a timestamp value
Thanks for trying to help me
dispy
EDIT: I forgot:
records in de12_conquer: 625,687
reconrds in de12_tribe:7,616
Last edited by dispy; Jun 24th, 2008 at 9:22 am.
![]() |
Other Threads in the MySQL Forum
- Previous Thread: My Sql Connection Problem in WAMP SERVER2
- Next Thread: Stored procedure error
Views: 849 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for MySQL
"use" 1 agplv3 alfresco amazon api artisticlicense aws bizspark breathalyzer camparingtocolumns changingprices cmg communityjournalism contentmanagement contractors copyright court crm data database design developer development distinct dui eliminate enter enterprise error eudora facebook form foss gartner gnu government gpl greenit groupware hiring hyperic images innerjoins insert ip joebrockmeier join keyword keywords kickfire laptop law legal license licensing linux maintenance managing mariadb matchingcolumns metron microsoft microsoftexchange mindtouch multiple music mysql mysqlcolumnupdating mysqldatetimeordermax() mysqlindex mysqlinternalqueries mysqlquery mysqlsearch news open-xchange opengovernment opensource operand oracle penelope php priceupdating query referencedesign reorderingcolumns saas search select sharepoint simpledb spotify statement sugarcrm syntax techsupport thunderbird transparency update virtualization





