1 00:00:00,360 --> 00:00:02,900 ‫Obviously, there is no better approach here. 2 00:00:03,380 --> 00:00:06,480 ‫I'm not saying server side is best and client sucks. 3 00:00:07,020 --> 00:00:09,150 ‫There are advantages and disadvantages. 4 00:00:09,510 --> 00:00:10,980 ‫Let's start with a client. 5 00:00:11,010 --> 00:00:13,210 ‫What's the advantages with the client side? 6 00:00:13,230 --> 00:00:22,470 ‫So if I have a client side server, get what I will minimize the over the overhead on the on the server 7 00:00:22,470 --> 00:00:23,610 ‫side, if you think about it. 8 00:00:23,610 --> 00:00:32,340 ‫Right, because I'm going to execute everything the client takes the the the memory allocation and the 9 00:00:32,340 --> 00:00:33,300 ‫execution. 10 00:00:33,300 --> 00:00:33,570 ‫Right. 11 00:00:34,020 --> 00:00:35,370 ‫Transferring the results. 12 00:00:36,210 --> 00:00:40,970 ‫And the client is responsible for this cursor. 13 00:00:41,010 --> 00:00:41,340 ‫Right. 14 00:00:41,490 --> 00:00:46,110 ‫The server has nothing essentially serves the connection and the connections. 15 00:00:46,230 --> 00:00:47,270 ‫The cursor is closed. 16 00:00:47,290 --> 00:00:47,480 ‫Right. 17 00:00:48,210 --> 00:00:49,100 ‫However. 18 00:00:49,950 --> 00:00:50,350 ‫OK. 19 00:00:52,040 --> 00:00:54,800 ‫There are there disadvantages, This is. 20 00:00:56,230 --> 00:01:06,190 ‫If if you execute a side cursors, what happens is the network bandwidth bandwidth of the network is 21 00:01:06,190 --> 00:01:06,720 ‫huge. 22 00:01:06,730 --> 00:01:13,330 ‫If you're pulling a lot of roads like in this example, obviously it's a bad it's a bad practice to 23 00:01:13,330 --> 00:01:14,140 ‫do so. 24 00:01:14,440 --> 00:01:20,170 ‫But if you do that, then you'll end up with a lot of network. 25 00:01:20,530 --> 00:01:23,140 ‫You can saturate your your network bandwidth. 26 00:01:23,140 --> 00:01:23,380 ‫Right. 27 00:01:23,380 --> 00:01:28,750 ‫Essentially get your bandwidth and the other disadvantages. 28 00:01:28,810 --> 00:01:33,940 ‫Your client might not have that much memory to to process the stuff. 29 00:01:34,030 --> 00:01:35,170 ‫OK, so. 30 00:01:36,600 --> 00:01:41,490 ‫Advantages and disadvantages rights clients, but the server is now relieved of this, right? 31 00:01:42,810 --> 00:01:50,550 ‫The good thing about the server side cursor, which is this one server side cursors, is what what are 32 00:01:50,550 --> 00:01:53,490 ‫you going to do as you execute this oversight? 33 00:01:53,700 --> 00:01:57,690 ‫And you can see that it's the client is relieved, right? 34 00:01:57,700 --> 00:02:02,100 ‫So you put the overhead on the server versus the client. 35 00:02:02,100 --> 00:02:04,050 ‫So the server is now doing more work. 36 00:02:04,200 --> 00:02:07,020 ‫The server is keeping hold of these cursors. 37 00:02:07,020 --> 00:02:12,840 ‫And imagine hundreds of thousands of clients doing the same thing, opening all the server cursors and 38 00:02:12,840 --> 00:02:15,130 ‫the worst of all, leaking those cursor. 39 00:02:15,150 --> 00:02:17,490 ‫Oh, my God, your database. 40 00:02:17,490 --> 00:02:23,790 ‫You can endanger the database, right, of just overflowing the database because, hey, this is like 41 00:02:23,820 --> 00:02:27,370 ‫you leaving all these cursors and leaking all of them. 42 00:02:27,450 --> 00:02:38,610 ‫OK, but, you know, if you're using them very moderately and in a smart way, you can you can you 43 00:02:38,610 --> 00:02:40,770 ‫can actually benefit from server side cursus. 44 00:02:40,770 --> 00:02:41,100 ‫Right. 45 00:02:41,130 --> 00:02:44,700 ‫So, like, hey, I'm holding I'm processing like a million rows. 46 00:02:44,910 --> 00:02:47,640 ‫Let me process 1000 rolls as a result. 47 00:02:47,760 --> 00:02:48,640 ‫Do something with it. 48 00:02:48,660 --> 00:02:53,820 ‫I could do a mass-produced, for example, and do something within etel it to something else. 49 00:02:53,820 --> 00:02:54,110 ‫Right. 50 00:02:54,420 --> 00:03:01,620 ‫And then server circuses are great for that one process processing one million resort or whatever and 51 00:03:01,620 --> 00:03:06,360 ‫then doing something with it and then fetching 50 rolls at that time and doing something with it and 52 00:03:06,910 --> 00:03:07,410 ‫exiting. 53 00:03:08,190 --> 00:03:08,610 ‫But. 54 00:03:10,360 --> 00:03:11,680 ‫If you. 55 00:03:12,860 --> 00:03:18,530 ‫Shouldn't really use it all the time, especially if the application applications like you don't just 56 00:03:18,530 --> 00:03:23,980 ‫create server suckers for the fun of it, right, because you might leak and leaking can be dangerous, 57 00:03:23,990 --> 00:03:24,330 ‫guys. 58 00:03:24,350 --> 00:03:24,730 ‫All right. 59 00:03:24,920 --> 00:03:29,350 ‫I think I think that's the difference between server side and client side. 60 00:03:29,360 --> 00:03:32,830 ‫Obviously, there are advantages and disadvantages for both. 61 00:03:32,840 --> 00:03:33,080 ‫Right. 62 00:03:33,450 --> 00:03:39,260 ‫Obviously, you can stay with client side courses, but you have to be very careful when you --. 63 00:03:39,590 --> 00:03:42,010 ‫Never do this, never select all. 64 00:03:42,050 --> 00:03:43,880 ‫Obviously that's a bad thing. 65 00:03:44,120 --> 00:03:47,440 ‫Never do an unbounded query like we were doing here. 66 00:03:47,540 --> 00:03:50,270 ‫You get to do a where clause always. 67 00:03:50,690 --> 00:03:58,340 ‫You can essentially simulate a server side cursor by doing, I think, a let's call limit. 68 00:03:58,350 --> 00:03:58,680 ‫Right. 69 00:03:58,970 --> 00:04:01,010 ‫Give me give me the first results. 70 00:04:01,010 --> 00:04:01,340 ‫Right. 71 00:04:02,420 --> 00:04:09,320 ‫And if you do a server side cursor, remember, this is a completely stateful operation. 72 00:04:09,320 --> 00:04:09,600 ‫Right. 73 00:04:09,800 --> 00:04:12,340 ‫So you can't really use it. 74 00:04:12,350 --> 00:04:18,820 ‫Well, in a web environment, you cannot just do a service that creates a server cursor like you cannot 75 00:04:18,830 --> 00:04:20,570 ‫build it in a stateless manner. 76 00:04:20,640 --> 00:04:24,230 ‫OK, so I really prefer that personal, if you ask me. 77 00:04:24,230 --> 00:04:29,460 ‫I prefer clients like Curser and you have to be very, very diligent to do what you are doing. 78 00:04:29,480 --> 00:04:30,650 ‫All right, guys, that's it. 79 00:04:31,460 --> 00:04:32,420 ‫That's all for me today. 80 00:04:32,620 --> 00:04:33,350 ‫Enjoy this video. 81 00:04:33,650 --> 00:04:34,550 ‫That's it, guys. 82 00:04:34,700 --> 00:04:35,690 ‫Stay awesome. 83 00:04:35,720 --> 00:04:37,580 ‫I'm going to see in the next one dies. 84 00:04:37,760 --> 00:04:38,270 ‫Goodbye.