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 8541665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:52:55+00:00 2026-06-11T11:52:55+00:00

When paginating through our Phrase table it takes very long to return the results.

  • 0

When paginating through our Phrase table it takes very long to return the results.

In the sql logs we see many sql requests which don’t make sense to us:

Phrase Load (7.4ms)  SELECT "phrases".* FROM "phrases" WHERE "phrases"."id" IS NULL LIMIT 1
User Load (0.4ms)  SELECT "users".* FROM "users" WHERE "users"."id" IS NULL LIMIT 1

These add up significantly. Is there a way to prevent querying against null ids?

This is the underlying model:

class Phrase < ActiveRecord::Base
  belongs_to :user 
  belongs_to :response, :class_name => "Phrase",  :foreign_key => "next_id"
end
  • 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-11T11:52:57+00:00Added an answer on June 11, 2026 at 11:52 am

    In our case the culprit turned out to be hidden in our own code, namely in a sunspot block, which got called on save/update:

      searchable do
        integer :previous_ids, :multiple => true do
          previous.map { |previous| previous.id }
        end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing a table that will contain all our users which can also
I use Mechanize to loop through a table, which is paginated. I have a
I have a page that has a table list through AJAX pagination, all custom.
My rails project is paginating the HTML format but not the the others. Can
I'm paginating a list of items, and currently the page listed on page load
While trying to search with id sorting (and paginating) im getting from the log:
We just recently moved our DB from 9i to 10G (Yes..better late than never
how do i implement paging on xml data which is being called through php.
I've a search form in which a user enters the keyword and the results
This might sound like a very stupid question to some of you, but I

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.