Code Monkey home page Code Monkey logo

columns_on_demand's Introduction

ColumnsOnDemand
===============

Lazily loads large columns on demand.

By default, does this for all TEXT (:text) and BLOB (:binary) columns, but a list
of specific columns to load on demand can be given.

This is useful to reduce the memory taken by Rails when loading a number of records
that have large columns if those particular columns are actually not required most
of the time.  In this situation it can also greatly reduce the database query time
because loading large BLOB/TEXT columns generally means seeking to other database
pages since they are not stored wholly in the record's page itself.

Although this plugin is mainly used for BLOB and TEXT columns, it will actually
work on all types - and is just as useful for large string fields etc.


Compatibility
=============

Supports mysql, mysql2, postgresql, and sqlite3.

Currently tested against Rails 4.2.1, 4.2.0, 4.1.5, 4.0.9, 3.2.18, on Ruby 2.1.5.

Was also previously tested compatible with 2.3.14, 3.0.17, and 3.1.8 on Ruby 2.0.0
or 1.8.7 as appropriate, and may still work for them.


Example
=======

# Example.all will exclude the file_data and processing_log columns from the
# SELECT query, and example.file_data and example.processing_log will load & cache
# that individual column value for the record instance.
class Example
  columns_on_demand :file_data, :processing_log
end

# Scans the 'examples' table columns and registers all TEXT (:text) and BLOB (:binary)
# columns for loading on demand.
class Example
  columns_on_demand
end


Copyright (c) 2008-2015 Will Bryant, Sekuda Ltd, released under the MIT license

columns_on_demand's People

Contributors

tlconnor avatar tobmatth avatar willbryant avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.