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

  • SEARCH
  • Home
  • 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 5999869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:36:46+00:00 2026-05-23T00:36:46+00:00

I am implementing a Twitter app, where the app needs to cache details of

  • 0

I am implementing a Twitter app, where the app needs to cache details of users coming from Twitter. Would it be wise to serialize the data into a column called data? Or, in my User model, should I create a column for each field that is returned by the API request?

Reading about (ActiveRecord::Base) serialize.

If I go with the latter approach, I would end up with a lot of fields in my User model and if the Twitter API decides to add or remove fields in the future, then we would have to update our columns in our db respectively.

However, one advantage I can think of with this approach, is if each column was stored in the db. I could say, search for all twitter users based on location. I could also index the location column for faster queries. How does this compare to the serialized approach?

One will suggest: “Don’t search serialized data, just don’t do it”.

So I guess, I can have two columns: data (for serialized data), and location, no?

But lets add a few more twists:

  1. The app needs to sort users out by registered date. Not with our app, but with Twitter.
  2. The app should be able to search users by Twitter screen name or Twitter id.
  3. The app should be able to sort users out by followers, friends and statuses count.

Does this mean, I would need 8 columns in my db: data, location, twitter_created_at, twitter_screen_name, twitter_id, followers_count, friends_count and statuses_count? At this point, would it still be better to go for a mix-column-type approach, or just single each field to its own column.

Would you save the data returned from the API into a single column: data, or save each field in its own respective column, or have a mix of both (as described above)?

Your thoughts will be appreciated.

  • 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-05-23T00:36:47+00:00Added an answer on May 23, 2026 at 12:36 am

    So assume for a moment that you have a table with the following three columns:

    user_id, api_field_name, api_field_value
    

    In this table you can add a row for each api field you want to persist. For example:

    user_d     api_field_name        api_field_value
    1          "meaning_of_life"     42
    1          "swallow_type"        "africa"
    

    This means that user number 1 has these two custom parameters that are tied to the api…if the api changes later on and “swallow_type” is removed, you can get rid of that row. New api fields can be added on the fly.

    This is an easy way to handle custom parameters that can and do change periodically. It saves you from having to restructure a table each time the api changes.

    This is the point where I duck to avoid the incoming flak from DB purists…

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

Sidebar

Related Questions

It seems like implementing web-app like twitter/facebook-wall needs 1 huge feeds relational table (+
I'm looking at implementing an app getting Twitter authorization via Oauth in Java. The
I'm implementing a document server. Currently, if two users open the same document, then
I am implementing exception handling for our BizTalk services, and have run into a
I'm implementing a web app, which uses sessions. I'm using GWT and app engine
We just finished implementing OAuth in our RoR application using the Twitter gem .
I am implementing some ruby on rails code tweet stuff for my users. I
Implementing Equals() for reference types is harder than it seems. My current canonical implementation
Implementing a 'sandbox' environment in Python used to be done with the rexec module
When implementing a needle search of a haystack in an object-oriented way, you essentially

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.