Excluding records from SQL Query

I have a table which I am trying to return only records of rendition_type Interactive and no other associated rendition_type. If a records has more than one rendition_type, I need to exclude it from the list.

DOC_ID    RENDITION_ID    RENDITION_TYPE 001       001             Interactive 001       002             Web PDF 002       003             Interactive 003       004             Interactive 003       005             Print PDF 004       006             Interactive 005       007             Interactive 005       008             Web PDF 

I’m looking for a query that will return only rows where document_ID has Rendition_type type of only 1 and that type is Interactive.

Trigger working on 5 crore+ records

I’m using postgresql 11. I have a table with 50000000+ records.The table doesn’t have any partition. The table is in PROD. I need to create a trigger there which will update previous entries flag to false for each upcoming latest entry. Each upcoming latest entry will have true value on flag. The table has around 1300 inserts per minute. One of the column of that table contain json data as well.Here is the trigger script:

    CREATE TRIGGER trig_updaterow before insert on tab for each row execute procedure updaterow();       CREATE OR REPLACE FUNCTION updaterow() RETURNS trigger AS $  $   BEGIN update tab set flag ='0' where s = new.s and p = new.p and  c = new.c and m = new.m and e = new.e and flag = '1';  RETURN NEW; END; $  $   LANGUAGE plpgsql; 

I need to check in case of large number of inserts if the table will going to face any lock because of this trigger. I have tested it will bulk inserts on prod copy. However, still I’m not sure about this.

Upload large list (2 mln records) to SharePoint Online, from Access *.mdb

I try to migrate records from Access database to SharePoint list (about 2 millions records). I go to “External” tab, then “More..” and there is “Export to SharePoint list”. It failed after about 15’600 records saying “Cannot update. Database or object is in readonly mode”.

I also tried to “Import spreadsheet” from *.xlsx, but excel supports only about 1 mln rows, and gives errors if I select more than about 250’000 rows to import. It was very slow so I don’t know if it really can import these 250’000. but it tried 🙂

Maybe You have any ideas how to insert these records – maybe I can use Azure, upload *.mdb or *.accdb there and then sync with SharePoint list?..

There is not much columns, less then 10, but about 2 million rows.

How to find similar records using multidimensional array?

I have table that describes a movie release. This table consists of columns:

  • movie_id int
  • release_day int
  • showtime_count int
  • ticket_sold_count int

e.g. (1, 1, 100, 200) tuple describes movie ID 1, on the first day of the movie release when it had 100 showtimes and sold 200 tickets.

I have a movie that is 5 days into the release (e.g. (2,1,100,200), (2,2,150,300), (2,3,100,250), (2,4,150,300), (2,5,100,250)) and I want to find previous releases that have performed similarly up to this day into their release.

I know that I can calculate a distance between two points using <->. But how would I index and search the entire database for a movie where distance for days 1, 2, 3, 4 and 5 is the lowest?

Remove non-existing records from xrandr

I lost my connection to a third monitor about a month ago for unknown reason. I’ve been waiting if some update would fix it, but it seems to be a persistent problem. I need help.

Environment: basic ubuntu 18.04 installation. Dell laptop with TB16 Dock.

I noticed that my xrandr shows multiple monitors that do not seem to exists. The laptop has only a connector for one external HDMI display. I guess this might be related to the problem (maybe I connected my laptop to some external third display that screwed up some settings).

I tried to remove the ~/.config/monitors.xml, but that did not have an effect on the xrandr output. Is there a way to remove or reset the xrandr monitor database?

xrandr output when disconnected from the Dock

xrandr output when connected to the Dock

When I disconnect the working external display from the Dock, the disconnected monitor (hd) starts working and it is show in the xrandr on the same name as the previous monitor:

broken monitor gets the same ID in xrandr