By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,978 Members | 1,373 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,978 IT Pros & Developers. It's quick & easy.

same mysql query doesn't always return a result

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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.