by oreglio · 7y ago · 0 comments
In the original design of the database, they though it would be a great idea to use negative ID for system use (on the same tables that are being used for user data). No foreign key whatsoever.
Forward 2018 when we have to build a system that have to work with this widedly used database (it's for a french ERP). Because there is no index or foreign keys the queries are really slow which make our interface slow. Because the tables are accessible but belong to the ERP we cannot modify them because the ERP is under a licence so we don't have access to remodeling of the tables or how the data is processed before being saved in the database.
So to work around the problem we had to create duplicates of the tables with proper index and foreign keys and start a cron job every minute to read from the original tables and fill the datas into our tables ...
Mind boggling .. The software is being sold to a lot of companies which is kind of sad.
There is a lot of topics discussing the use of negative ID when the ID store the same datas all the way from negative to positive.
But storing unrelated datas - data reserved to the system for the developper - on the negative IDs of table ... to "save space" ? That for me is bad database design and a problem.
Of course it affects price and development speed which may in the long run sink the company in the marketplace, like what happend to e.g. QuarkXPress.