All Questions
Tagged with postgresql ruby
12 questions
1
vote
2
answers
87
views
Querying and rendering an HTML table of ISP performance statistics
I have multiples measurements and I want to render it into tables like this
Measurements
Operator
browsings
FTP DL
FTP UL
Location
Event
Date
Operator
avg
min
max
avg
min
max
avg
min
max
Verizon
...
3
votes
0
answers
130
views
Assigning raffle numbers to users in Rails
Background
One part of our Rails app is running a Raffle, usually twice a month, with around 600k entrants each round. Each raffle ticket record will have at least a unique raffle number (consisting ...
2
votes
1
answer
617
views
Offset vs Cursor Pagination
I am trying to compare any performance gain(s) from moving a current offset-based pagination endpoint to a cursor based one.
I have the following ruby code:
...
2
votes
1
answer
240
views
Listing employees, categorized by license expiration date
I am working on a personal project and I have hit a wall. I know I am writing bad code and I really want to refactor the code below. The application has three tables on the same page. Each table ...
3
votes
1
answer
223
views
Imported data from CSV successfully, but slow
Currently I am using the gem activerecord-import to seed more than 55,000 records into my database, and it works fine. However, it takes too much time. I am ...
3
votes
1
answer
378
views
Getting timeslots using a single query
I want to get latest time slots for 2 cases based on doorman true for false based on logged in user.
Cases are:
If doorman is true, the query will be the same
if doorman is false, then I need to add ...
4
votes
1
answer
345
views
Monitoring and re-establishing a PostgreSQL connection
Within a complicated Ruby project, I need to monitor the connection to a PostgreSQL database, as answered here. I use a thread for this purpose. Every few milliseconds, I invoke "consume_input" which ...
2
votes
0
answers
87
views
Fetching photos and tweets related to selected publications
1) Postgresql
2) User has_many :reports
3) Report belongs_to :user
3) Report belongs_to :publication
4) Publication has_many :reports
4) Publication scope :photos, -> ...
2
votes
1
answer
129
views
Building query for search engine
I'm writing a basic search engine for my website.
It works but I'm really unhappy with the code. I know it can't be improved but I'm lacking some experiences here.
In my params from my search I get:
...
5
votes
2
answers
1k
views
How to properly call an "upsert" using parameterized raw SQL to Postgresql in ActiveRecord?
I need to call an upsert to my Category table in PostgreSQL. My current solution uses the exec_query API in ActiveRecord, using ...
7
votes
1
answer
13k
views
Faster way to update/create of a large amount of records?
In our Rails 3.2.13 app (Ruby 2.0.0 + Postgres on Heroku), we are often retreiving a large amount of Order data from an API, and then we need to update or create each order in our database, as well as ...
2
votes
1
answer
287
views
Importing markdown files
I'm building a rails app that, among other things, imports text markdown files as blog posts. The idea is that the truth is in the markdown files, so any time those are edited, created, or deleted, ...