Coder Social home page Coder Social logo

ecshreve / jepp Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 119.88 MB

api fun with jeopardy!

Home Page: https://jepp.app

License: MIT License

Go 84.18% Smarty 9.72% CSS 4.61% Dockerfile 1.49%
api colly data gin-gonic github-actions go golang jeopardy mysql scrape trivia

jepp's People

Contributors

dependabot[bot] avatar ecshreve avatar

Stargazers

 avatar  avatar

Watchers

 avatar

jepp's Issues

database query improvement

Screenshot 2023-06-25 at 11 30 25 PM

the /api/clue?random query is the culprit behind the slowest query here.

func GetRandomClue() (*Clue, error) {

SELECT * FROM <table-name> ORDER BY RAND() LIMIT 1 works just fine for small tables, but real bad for this big (~350k row table).

the sqlx documentation helps explain

Select can save you a lot of typing, but beware! It's semantically different from Queryx, 
since it will load the entire result set into memory at once. If that set is not bounded by 
your query to some reasonable size, it might be best to use the classic Queryx/StructScan
 iteration instead.

probably going to do something like picking a random game first, and then a random clue from the game. maybe caching a chunk of random clues when the server starts could work too. haven't given it too much thought yet

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.