Let's say I have these tables / models:
Product
- id
- last_updated_date
- name
- price
User
- id
- name
WishlistItem
- id
- user_id
- product_id
The product table contains several million records and is updated automatically every night by importing data (insert into a new table, discard the old one). I basically have read-only access to this table / model.
If the product is on the user's wish list and the price drops, I would like to be able to notify this user. What methods can be used for this?
I have a couple of ideas:
Track Product.last_updated_date in the wishlist model and periodically poll the product table to see if it is updated. It sounds like a terrible / non-scalable solution.
Postgres View Function, Product? postgres, , .
- , , :)
!
UPDATE:
, , , :
WishlistItem
- id
- user_id
- product_id
- price
... , , WishlistItem.price Product.price . , , WishlistItem , , . , .
UPDATE:
, , , , . , ..