467,130 Members | 1,392 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,130 developers. It's quick & easy.

same mysql query doesn't always return a result

We have no access to a mysql NG on my provider's server, so we ask here:

We have a long query (long in text) with a UNION between 2 select.

We have been informed that some times the query doesn't return any result.
We have tried on our server and we always get a result. BUT, trying on the
hosting server, many times the query doesn't return any result and doesn't
get any error.

Any idea ? does Union have any problem ? how to check if the query failed ?
My hoster said that sometimes the table can be locked (if the server is
overloaded) and then mysql doesn't return any result, but this seems to me
an aberration.

the query takes about 0.0050 sec to execute when it doesn't return any
result, and 0.030 when I get results

Please help !

Sep 9 '05 #1
  • viewed: 3102
Share:
4 Replies
Bob Bedford said the following on 09/09/2005 08:04:
We have no access to a mysql NG on my provider's server, so we ask here:

We have a long query (long in text) with a UNION between 2 select.

We have been informed that some times the query doesn't return any result.
We have tried on our server and we always get a result. BUT, trying on the
hosting server, many times the query doesn't return any result and doesn't
get any error.

Any idea ?


What is the query?
--
Oli
Sep 9 '05 #2
Do you mean the query string is long, or the result set is? How long are we
talking?

Some things to try:

Right after executing the query if you don't get a result, do an "echo
mysql_error();" This will tell you if there was an error message.

Check MySQL's "max_allowed_packet" variable. This can cause problems with
long queries (although you should get an error).

Is it possible that the result of your query really is empty (i.e., the
WHERE or HAVING clauses aren't satisfied)?

- Kevin

"Bob Bedford" <be******@notforspammershotmail.com> wrote in message
news:43**********************@news.sunrise.ch...
We have no access to a mysql NG on my provider's server, so we ask here:

We have a long query (long in text) with a UNION between 2 select.

We have been informed that some times the query doesn't return any result.
We have tried on our server and we always get a result. BUT, trying on the
hosting server, many times the query doesn't return any result and doesn't
get any error.

Any idea ? does Union have any problem ? how to check if the query failed
?
My hoster said that sometimes the table can be locked (if the server is
overloaded) and then mysql doesn't return any result, but this seems to me
an aberration.

the query takes about 0.0050 sec to execute when it doesn't return any
result, and 0.030 when I get results

Please help !

Sep 9 '05 #3
Hello Kevin, thanks for the reply,
Do you mean the query string is long, or the result set is? How long are
we talking? The query itself, it must return 2 results quite shorts.
Some things to try:

Right after executing the query if you don't get a result, do an "echo
mysql_error();" This will tell you if there was an error message.

Check MySQL's "max_allowed_packet" variable. This can cause problems with
long queries (although you should get an error).

Is it possible that the result of your query really is empty (i.e., the
WHERE or HAVING clauses aren't satisfied)?

No, as the query is ALWAYS the same and no changes are made on the database
(no new records, no changes at all).
There is no error, that's the strangest thing.

It's like the query wouldn't return any result, but when done again, then it
returns a result. The behaviour is quite random. It may work 5 times and
then not 2 times then work again once then not 6 times....

very strange.
Sep 14 '05 #4
Hello Oli,

thanks for reply,

"Oli Filth" <ca***@olifilth.co.uk> a écrit dans le message de news:
Dv***********@newsfe7-win.ntli.net...
Bob Bedford said the following on 09/09/2005 08:04:
We have no access to a mysql NG on my provider's server, so we ask here:

We have a long query (long in text) with a UNION between 2 select.

We have been informed that some times the query doesn't return any
result.
We have tried on our server and we always get a result. BUT, trying on
the
hosting server, many times the query doesn't return any result and
doesn't
get any error.

Any idea ?


What is the query?


it something like (select x,y,z from 3 tables, with 10 left and inner join)
union (same thing than first query)

It shouldn't change anything, since the real problem is that sometimes it
works and sometimes it doesn't.

Bob
Sep 14 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Phil Powell | last post: by
2 posts views Thread by chuy08@gmail.com | last post: by
2 posts views Thread by paranic | last post: by
10 posts views Thread by eholz1 | last post: by
15 posts views Thread by harvey | last post: by
2 posts views Thread by =?iso-8859-1?B?Sm/jbyBNb3JhaXM=?= | last post: by
21 posts views Thread by bruno_guedesav | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.