Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8826843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:14:33+00:00 2026-06-14T07:14:33+00:00

I am using ruby to perform a query on a MySQL db. I’m looking

  • 0

I am using ruby to perform a query on a MySQL db. I’m looking for matches of uids with:

WHERE uid in #{VERY_LARGE_COMMA_SEPARATED_LIST}

The VERY_LARGE_COMMA_SEPARATED_LIST is over 30k entries

VERY_LARGE_COMMA_SEPARATED_LIST = ' "one","two","three",...,"30k" '

and it causes sql to dump error:

Mysql2::Error - MySQL server has gone away:

Does anyone know what is going on here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T07:14:35+00:00Added an answer on June 14, 2026 at 7:14 am

    You must be going over typical 1MB mysql SQL command buffer.

    To solve your problem, you should create (possibly temporary) table uids which contains just uid’s, something like

    CREATE TABLE uids (uid INT NOT NULL PRIMARY KEY);
    

    (be sure that index exists for uid).

    Then INSERT necessary uid’s into uids table in few statements like this:

    INSERT INTO uids (uid) VALUES (1),(5),(10),..;
    

    Finally, run your query as:

     WHERE uid IN (SELECT uid FROM uids)
    

    or join like this:

     SELECT m.*
     FROM master m, uids u
     WHERE m.uid = u.uid
     ...
    

    In the end, you may want to drop your uids table.

    EDIT: I missed that your uid is not integer. Simply adjust definitions for it to use VARCHAR instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Ruby on Rails. I'm trying to sort a query by number (saved as
Using Ruby, how can I perform background and foreground text colorization for output in
I am using Ruby on Rails 3.0.7 and I would like to perform the
Using Ruby, I'm trying to parse some documentation in which I need to split
Using Ruby 1.8.6 & Rails 1.2. Models: Job , JobExtraStop : class JobExtraStop <
Using ruby-1.9.3... I've read some of the canonical blog posts on the subject of
using Ruby on Rails 2.3.2, since I already created Scaffold for Story, so instead
Using Ruby (newb) and Regex, I'm trying to parse the street number from the
Using Ruby/RoR - The year is a string in the model/view. How do I
Using ruby regexp I get the following results: >> 'foobar'[/o+/] => oo >> 'foobar'[/o*/]

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.