same mysql query doesn't always return a result

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Bedford

    #1

    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 !



  • Oli Filth

    #2
    Re: same mysql query doesn't always return a result

    Bob Bedford said the following on 09/09/2005 08:04:[color=blue]
    > 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 ?[/color]

    What is the query?


    --
    Oli

    Comment

    • Kevin

      #3
      Re: same mysql query doesn't always return a result

      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_pa cket" 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" <bedford1@notfo rspammershotmai l.com> wrote in message
      news:432133e9$0 $1161$5402220f@ news.sunrise.ch ...[color=blue]
      > 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 !
      >
      >
      >[/color]


      Comment

      • Bob Bedford

        #4
        Re: same mysql query doesn't always return a result

        Hello Kevin, thanks for the reply,[color=blue]
        > Do you mean the query string is long, or the result set is? How long are
        > we talking?[/color]
        The query itself, it must return 2 results quite shorts.
        [color=blue]
        > 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_pa cket" 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)?[/color]
        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.


        Comment

        • Bob Bedford

          #5
          Re: same mysql query doesn't always return a result

          Hello Oli,

          thanks for reply,

          "Oli Filth" <catch@olifilth .co.uk> a écrit dans le message de news:
          DvdUe.26$2y.0@n ewsfe7-win.ntli.net...[color=blue]
          > Bob Bedford said the following on 09/09/2005 08:04:[color=green]
          >> 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 ?[/color]
          >
          > What is the query?[/color]

          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


          Comment

          Working...