4

I am building a price comparison site that holds about 300.000 products and several hundred clients.

On a daily basis the site needs updating of prices and vendor stock availability.

When a vendor needs updating I was thinking about deleting all the vendor information and then pulling and inserting a new - each time.

Doing this I don't have to worry about a vendor deleting a product. In a simple way I would get a new set of data each day.

On the other hand I need to keep the autoincrement counter in check and it seems a waste to delete everything from a vendor if he has only updated prices on 3 products in his entire warehouse.

But updating has its disadvantages too. I still have to read out all data and compare each and every product price/availability to the data from the vendor, one product at a time. Also it's more complicated to notice products that gets deleted by the vendor.

How do I achieve updating in the most efficient and easy way?

fresskoma
  • 25,481
  • 10
  • 85
  • 128
user937635
  • 59
  • 5

1 Answers1

0

I am not sure of what database technology you are using. In any case, a database supports handling of relationships between multiple tables. It is up to you to implement the concepts. For example, you can use the CASCADE option when creating a table A that references table B (by primary keys for example) to ensure that an update/delete of tuples in table B cascades (reflects) that corresponding tuple in table A.

See example of CASCADING and when to use

Community
  • 1
  • 1
GeekByte
  • 21
  • 4