Coder Social home page Coder Social logo

index_hunter's People

Contributors

davidgeismar avatar

Watchers

 avatar  avatar  avatar

index_hunter's Issues

Make a better algorithm to optimize indexes

IndexOptimiser

find_covering_indexes could be better

  • So far the logic of the index_optimiser is pretty simple :
  1. take columns in the queries with most columns criteria, sort them by cardinality, create indexes for them.
  2. check if these indexes covers the other queries
  3. if not create index for these other queries

Make a better Regex in query_finder to collect queries in project

QueryFinder

Make better regex to match queries

  • only handling active record
  • doesnt work for chained method when result of query is put into variable
    Ex : transactions = MerchantTransaction.where(status: 1)
    transactions.where(kind: 'BATCH_BET') is not caught by regex
  • replace_variables_in_query_string could be maybe improved with a config_file and a parser that automatically replaces variables

Retrieve sql and fields from direct active record db call (find_by, find...)

QueriesDeconstructor

retrieve_query_fields could be better

Right now, to retrieve the column criterias from the queries. I instantiate them as lambdas then call where_values_hash on them.
This method gives info about the query, which is cool.
Hwver where_values_hash only works for active_record method that dont directly call the db ==> not working with all of those :
ACTIVE_RECORD_NOT_SQLABLE = ['find', 'find_by', 'find_by!', 'find_by_sql', 'pluck', 'take', 'exists?', 'any?', 'many?', 'count', 'minimum', 'maximum', 'sum']

I do a dirty hack by transforming temporarily a .find_by into a .where. WE CAN DO BETTER

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.