New answers tagged


Please provide an example of the queries you're currently using, and your table definitions, in your post. As it stands now, your question isn't very clear, especially on how loops are even relevant here. That being said, with the current information you provided, it sounds like you guys could possibly benefit from dynamic SQL by leveraging the system stored ...


From MySQL 8.0.20, instead of adding the global SELECT permissions (too broad), add the new SHOW_ROUTINE permissions: GRANT SHOW_ROUTINE ON *.* TO <USER>@<LOCATION>;


After seeing Michael Green's answer, which is full of great points, I wanted to provide some additional thoughts to weigh against his points. I'm not trying to win the argument for the side of using stored procs, per se, but I do believe they are often misunderstood and/or misrepresented in these kinds of conversations. A) Scale - SQL statements have to be ...


If you just want one specific procedure: SHOW PROCEDURE STATUS WHERE `name` = 'value'


VIEWs are syntactic sugar, not a way to speed up anything. This will create a new table from a select: CREATE TABLE foo SELECT ....; This creates a TEMPORARY table that will go away when you disconnect: CREATE TEMPORARY TABLE foo SELECT ....; To rebuild the table daily, this will repopulate it: TRUNCATE TABLE foo; INSERT INTO foo ...


No, a trigger needs to call a trigger function. But there is nothing that keeps you from writing a PL/pgSQL trigger function that CALLs the procedure of your liking.

Top 50 recent answers are included