Strange error


#1

Since a week ago, I get this error when using some tables of the database…

Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.

Does anybody know why is this?


#2

Which server is your database on?

According to dreamhoststatus.com the server ‘odie’ has been experiencing some problems.

You can find which server your database is on by going to Status -> MySQL Usage in the panel.

Mark


Save [color=#CC0000]$50[/color] on DreamHost hosting using promo code [color=#CC0000]SAVEMONEY[/color] ( Click for promo code details )


#3

It’s on server solomon. And I’ve seen that only happens when I do a SELECT like this:

SELECT col1, col2 from table where col3 like ‘%’;

Then, the 503 error appears.


#4

How big is the table you’re querying? I realize that the query you showed us was for purpose of example, but you do have some value in the LIKE clause, right? If not, you might want to try “WHERE col3 IS NOT NULL”

Are any of these columns defined as LONGTEXT datatypes? Have you tried indexing some of the columns?
FROM http://dev.mysql.com/doc/refman/5.0/en/indexes.html

How much data is in the columns you’re returning?
FROM http://dev.mysql.com/doc/refman/5.0/en/blob.html

http://benconley.net
http://teamshocker.com


#5

The table is very small, there are only 15 rows. The “IS NOT NULL” option is not a possible solution. The ‘%’ is passed as a parameter. If the user selects to see only “online games”, the parameter passed is “online”.
So, the SELECT returns all the rows where the value of column “TYPE” is like “online”.
If the user selects to see all games, the parameter is “%” and the SELECT returns all rows where the value of column “Type” is like “%” (all the rows).

I don’t know if I’ve explained it correctly, sorry for my bad English.

I think I use indexes, but I don’t think that’s the problem.


#6

Have you verified that the column “TYPE” is actually a text field, and not a numeric column used as a “foreign key” to a “types” table? It should be I guess, this process is called normalization and is a fundamental aspect of data modeling.

You can tell by viewing the source of the page where users can select the type from a select box. The “value” property will either be text or a number. That will give us our answer.

This page is running in PHP right? You can easily use the IS NOT NULL with conditional logic. Here’s a pseudocode snippet that would be relevent.

if (strcasecmp($cPassedParamTxt,"%")) {
$queryStr = $queryStr." AND b.TYPE LIKE ‘%".$cPassedParamTxt."%’";
}
else {
$queryStr = $queryStr." AND b.TYPE IS NOT NULL ";
}

http://benconley.net
http://teamshocker.com


#7

TYPE is text field, yes.

I thought about the other solution, doing that with IS NOT NULL, but a week ago everything worked, so the code must be OK. I’ll wait till Dreamhost administrators’ answer (I’ve written them) and if it’s impossible to make it work without changing the code I’ll have to use that pseudocode…

Thanks a lot!