w10schools
Login Register
MENU
  • Home
  • Tutorials ►
    • HTML, CSS ►
      • HTML, HTML5
      • CSS, CSS3
    • XML
    • JavaScript, AJAX
    • PHP
    • Ruby on Rails ►
      • Ruby
      • Rails
    • ASP.NET ►
      • ASP
      • C# .NET
    • Java ►
      • JSP
    • Databases ►
      • MySQL
      • MSSQL Server
      • Oracle
    • Web Server ►
      • Windows
      • Linux
      • Apache
      • IIS
    • Design ►
      • Dreamweaver
      • Flash
      • Photoshop
      • Fireworks
      • CorelDRAW
      • Illustrator
  • References ►
    • HTML ►
      • Bootstrap
    • CSS ►
      • CSS Selectors
      • Sass
    • JavaScript
    • Mobile Apps ►
      • Cordova
    • Ruby on Rails ►
      • Ruby
      • Rails
    • PHP ►
      • Function
      • Language
      • CodeIgniter
      • Phalcon
      • PHPUnit
      • Symfony
      • Drupal
      • Yii
      • Laravel
    • Perl ►
      • Perl
    • Python ►
      • Python
      • Django
      • NumPy
      • Pandas
      • scikit-image
      • scikit-learn
      • Statsmodels
      • Matplotlib
    • Lua ►
      • Lua
    • C, C++ ►
      • C
      • C++
    • Server ►
      • Docker
      • Apache HTTP Server
      • Nginx
    • Database ►
      • PostgreSQL
    • Big Data ►
      • TensorFlow
    • Game Development ►
      • Phaser
      • LÖVE
  • Articles ►
    • News
    • General ►
      • Website Promotion
      • Online Advertising
      • Make Money Online
    • Editorials
    • Interviews
    • Web Roundups
  • Resources ►
    • Design ►
      • Fonts
      • Graphics
      • Vectors
      • Templates
      • UI (User Interface)
      • Brushes
      • Patterns, Backgrounds
      • Textures
    • Web Development ►
      • HTML, CSS
      • XML
      • JavaScript, AJAX
      • Ruby on Rails
      • PHP
      • Java
      • .NET
      • Python
      • Perl
      • Flash
    • Mobile Application Development ►
      • Mobile Development Tools
      • Swift
    • Online Services ►
      • Online Storage
      • Web Hosting
  • Tools ►
    • Generators
  • Home
  • Tutorials
    • HTML, CSS
      • HTML, HTML5
      • CSS, CSS3
    • XML
    • JavaScript, AJAX
    • PHP
    • Ruby on Rails
      • Ruby
      • Rails
    • ASP.NET
      • ASP
      • C# .NET
    • Java
      • JSP
    • Databases
      • MySQL
      • MSSQL Server
      • Oracle
    • Web Server
      • Windows
      • Linux
      • Apache
      • IIS
    • Design
      • Dreamweaver
      • Flash
      • Photoshop
      • Fireworks
      • CorelDRAW
      • Illustrator
  • References
    • HTML
      • Bootstrap
    • CSS
      • CSS Selectors
      • Sass
    • JavaScript
    • Mobile Apps
      • Cordova
    • Ruby on Rails
      • Ruby
      • Rails
    • PHP
      • Function
      • Language
      • CodeIgniter
      • Phalcon
      • PHPUnit
      • Symfony
      • Drupal
      • Yii
      • Laravel
    • Perl
      • Perl
    • Python
      • Python
      • Django
      • NumPy
      • Pandas
      • scikit-image
      • scikit-learn
      • Statsmodels
      • Matplotlib
    • Lua
      • Lua
    • C, C++
      • C
      • C++
    • Server
      • Docker
      • Apache HTTP Server
      • Nginx
    • Database
      • PostgreSQL
    • Big Data
      • TensorFlow
    • Game Development
      • Phaser
      • LÖVE
  • Articles
    • News
    • General
      • Website Promotion
      • Online Advertising
      • Make Money Online
    • Editorials
    • Interviews
    • Web Roundups
  • Resources
    • Design
      • Fonts
      • Graphics
      • Vectors
      • Templates
      • UI (User Interface)
      • Brushes
      • Patterns, Backgrounds
      • Textures
    • Web Development
      • HTML, CSS
      • XML
      • JavaScript, AJAX
      • Ruby on Rails
      • PHP
      • Java
      • .NET
      • Python
      • Perl
      • Flash
    • Mobile Application Development
      • Mobile Development Tools
      • Swift
    • Online Services
      • Online Storage
      • Web Hosting
  • Tools
    • Generators
Edit
In Place Editing Advanced Editing
  • References
  • Ruby on Rails
  • Rails
  • Classes
  • ActiveRecord
  • ActiveRecord::Relation

explain

explain()
Instance Public methods

Runs EXPLAIN on the query or queries triggered by this relation and returns the result as a string. The string is formatted imitating the ones printed by the database shell.

Note that this method actually runs the queries, since the results of some are needed by the next ones when eager loading is going on.

Please see further details in the Active Record Query Interface guide.

Links:
  • https://github.com/rails/rails/blob/257d65ed2ceb14dca6b1319355ed4f8a73540498/activerecord/lib/active_record/relation.rb#L231
doc_ruby_on_rails
doc_ruby_on_rails
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.

Popular Articles
explain explain(arel, binds = []) Instance Public methods DATABASE STATEMENTS ======================================
explain explain(arel, binds = []) Instance Public methods
explain explain(arel, binds = []) Instance Public methods DATABASE STATEMENTS ======================================
EXPLAIN NameEXPLAIN -- show the execution plan of a statement Synopsis EXPLAIN [ ( option [, ...] ) ] statement EXPLAIN [ ANALYZE ] [ VERBOSE ] stateme
MongoCursor::explain (PECL mongo >=0.9.2) Return an explanation of the query, often useful for optimization and debugging


Return to View
^ Back to Top
  • Facebook
  • Tweet
  • Digg it
  • Stumbleupon
  • Delicious
  • Plus Share

Designed by : w10schools

service@w10schools.com

Our Partners: aeeble – Providing content publishing and search solutions