Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3607836
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:25:34+00:00 2026-05-18T21:25:34+00:00

Let’s say I have these tables/models: Product – id – last_updated_date – name –

  • 0

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 has a few million records and is being updated automatically each night via a data import (inserting into a new table, dropping the old one). I basically have read-only access to that table/model.

If a product is on a user’s wishlist and the price drops, I’d like to be able to notify that user. What methods can be used to do this?

I have a couple of ideas:

  1. Keep track of the Product.last_updated_date in the wishlist model and periodically poll the product table to see if it has been updated. This sounds like a horrible/non-scaleable solution.

  2. Some sort of Postgres View or Function that triggers when the Product table is updated? I’m new to postgres so I’m not yet sure if this is even possible.

  3. Something amazing that you will suggest that I haven’t thought of 🙂

Any help in the right direction is greatly appreciated!


UPDATE:
One idea that came up was caching the current price inside the wishlist entry itself, ie:

WishlistItem
- id
- user_id
- product_id
- price

… then, after the import, I could compare WishlistItem.price with Product.price and notify accordingly. Although it would work, this approach seems a bit wasteful since every WishlistItem for every user will essentially have the same cached copy of the price data and I’ll have to update every list with the new price if there’s an update. I’m not sure there’s a way around it though.


UPDATE:
In the end I decided I should probably just be tracking all versions of the data so that I can use standard on update triggers. This also allows me to have a record of all price changes so I can track pricing trends, etc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:25:35+00:00Added an answer on May 18, 2026 at 9:25 pm

    You could use an update trigger on Product but it sounds like the Product table is not actually being updated, it is being replaced; if this is the case then there is no update to trigger the trigger so you’ll have to do it the hard way by caching the price in Wishlist (as user247245 notes) and scanning Product for price changes.

    If Products is being updated rather than replaced wholesale, then an update trigger could be used to note when a price changes and arrange to have the interested parties notified. The trigger would probably queue up the notifications by inserting them into a separate table (to avoid locking up the Products update) called, say Product_price_changes; then, when the Products update is done, a separate task can compare Product_price_changes to Wishlist, notify the interested users, and finish off by deleting everything in Product_price_changes.

    Note that recent versions of PostgreSQL you can restrict an update trigger to only fire when a column changes rather than firing on every row change.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have a javascript array with a bunch of elements (anywhere from
Let's say I have a dataset, which can be neatly classified using weka's J48
Let say I have two UIViews: View1: - bounds: 0, 0, 20, 20 -
Let's say I have the following function in C#: void ProcessResults() { using (FormProgress
Let's say I have two assemblies: BusinessLogic and Web. BusinessLogic has an application setting
Let give you the details of this rather odd issue. We have a very
Let's say I'm writing a Windows Forms (.NET Framework 3.5) application which shows the
Let's assume I want to deserialize this (I've removed the namespaces to make things
Let's suppose I've got a 2D vector template class: template<typename T> class Vec2 {
Let simplify the question: All I need is to explode() string by a comma

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.