Giter VIP home page Giter VIP logo

Comments (5)

drnic avatar drnic commented on May 29, 2024 1

@andyatkinson thanks; I didn't realised I forgot to write up about indexes so I've put some docs in #3

Unrelated, but I was in the swing of things, so #3 also starts to port over some solutions I have for text searching.

from searchcraft.

drnic avatar drnic commented on May 29, 2024 1

I personally cannot use the pg_ivm extension due to our constraints on our production host; but I can imagine supporting this alternate syntax SELECT create_immv('myview', 'SELECT * FROM mytab'); instead of CREATE MATERIALIZED VIEW myview AS SELECT * FROM mytab;. "How hard could it be?"

Currently the wrapper SQL for the MV is at

"CREATE MATERIALIZED VIEW #{view_name} AS (#{inner_sql}) WITH DATA;"

from searchcraft.

drnic avatar drnic commented on May 29, 2024 1

Thanks, yeah I haven't yet documented how to setup concurrent refreshes; nor documented how to add a new unique index column using the sequence that's already created for you. I've created #4 to track this.

from searchcraft.

drnic avatar drnic commented on May 29, 2024 1

@andyatkinson I appreciate your comments + questions + requests for better docs. Please let me know of any other ideas you have. I definitely don't know "all things MV".

from searchcraft.

andyatkinson avatar andyatkinson commented on May 29, 2024

@drnic Makes sense on the pg_ivm extension.

Also, re: indexes, passing on something else useful in case you didn't already know: refreshing a materialized view ideally is done "concurrently", so that other queries using it can continue to run while the results are replaced. Concurrent refreshes do require one unique index exists on the materialized view:

For here: https://github.com/drnic/searchcraft/blob/develop/lib/searchcraft/model.rb#L44

Docs on the concurrently keyword and unique index requirement: https://www.postgresql.org/docs/current/sql-refreshmaterializedview.html

from searchcraft.

Related Issues (2)

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.