WordPress Admin Page Slow. Customer Post Type is the slowest

The admin page loads slowly ever since adding Custom Post types. I’ve added them using CPT UI and Custom Fields plugins in WordPress. Whenever you click on the Custom post type from the sidebar it takes 8.74s to load. With one of the queries showing as “slow” according to debug bar plugin. See screenshot.

Context: I’ve created a site that hosts advertiser listings. We have about 700 advertisers with 20 fields.

How would one fix these load times? Does someone notice anything odd in the query?

Screenshot of debug bar details

What is the correct way of grabbing a RANDOM record from a PostgreSQL table, which isn’t painfully slow or not-random?

I always used to do:

SELECT column FROM table ORDER BY random() LIMIT 1; 

For large tables, this was unbearably, impossibly slow, to the point of being useless in practice. That’s why I started hunting for more efficient methods. People recommended:


While fast, it also provides worthless randomness. It appears to always pick the same damn records, so this is also worthless.

I’ve also tried:


It gives even worse randomness. It picks the same few records every time. This is completely worthless. I need actual randomness.

Why is it apparently so difficult to just pick a random record? Why does it have to grab EVERY record and then sort them (in the first case)? And why do the “TABLESAMPLE” versions just grab the same stupid records all the time? Why aren’t they random whatsoever? Who would ever want to use this “BERNOULLI” stuff when it just picks the same few records over and over? I can’t believe I’m still, after all these years, asking about grabbing a random record… it’s one of the most basic possible queries.

What is the actual command to use for grabbing a random record from a table in PG which isn’t so slow that it takes several full seconds for a decent-sized table?

How do Plant Growth and Slow interact with each other?

How do Plant Growth and Slow interact with each other?

If on spell-caster casts Plant Growth in an area and the other targets a creature with the Slow spell, what happens?

Supposing that the creature fails its saving throw against Slow would this mean that, while it is within the area affected by Plant Growth, its movement is two times, four times, or eight times slower?

I have got an inkling that the creature would only move 1 foot for every 8 feet of movement, but not sure is those two effects stack.

Thanks for your help with this.

How can I improve this slow query in my wordpress site?

SELECT object_id, term_taxonomy_id FROM wp_term_relationships INNER JOIN wp_posts ON object_id = ID WHERE term_taxonomy_id IN (525627,516360,525519,535782,517555,525186,517572,549564,1,517754,541497,541472,525476,549563,517633,524859,702393,541604,543483,524646,525001,550518,541516,525244,549565,517376,535783,524642,25,533395,533537,525475,2,705306,524684,525065,939122,541603,525523,533491,541590,702713,550724,525243,533634,525122,541498,549586,546982,21,524643,541478,525435,535784,541471,516611,535781,541638,516142,533416,546984,524999,533453,524682,704994,516579,516189,524644,517378,525185,541508,517634,705305,524858,517632,541637,517699,525064,517573,772367,516609,517375,525474,507436,524918,517635,541929,22,54,53,705119,524685,524683,516577,536343,191228,524915,524917,516298,541573,546983,515904,541601,56,517377,524645,517707,515905,516297,515903,517708,533635,516296,516578,517750,517554,516016,525123,533538,541625,525187,705307,55,191226,19,24,516299,541466,524916,772366,555654,516612,541503,191227,550302,991853,920642,191229,535829,525582,525524,524919,524720,525841,517636,541504,525184,525520,541562,525433,541563,516610) AND post_type IN ('post') AND post_status = 'publish' + _pad_term_counts() Theme   259514  2.0440  SELECT wp_posts.ID FROM wp_posts LEFT JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) WHERE 1=1 AND wp_posts.ID NOT IN (391534) AND ( wp_term_relationships.term_taxonomy_id IN (2,516296,517375,517376,517377,517378,517554,517555,517572,517573,517632,517633,517634,517635,517636,517699,517707,517708,517750,517754,524858,524859,524915,524916,524917,524918,524919,524999,525001,525064,525065,525185,525186,525187,525519,525520,525523,525524,525582,525841,533395,533416,533453,535782,535783,535784,535829,536343,549563,549564,549565,549586,550302,550518,550724,555654,702393,702713,704994,705119,705305,705306,705307,772366,772367,920642,939122,991853) ) AND wp_posts.post_type = 'post' AND ((wp_posts.post_status = 'publish')) GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 6 How can I improve this query ? I have many posts and they are taking like 2secs each. 


I also found this extra info that I think would help…

Why do you think modifying WordPress core table is a good idea? – Krzysiek Dróżdż♦ Jun 12 ’15 at 4:21 I really don’t think it’s a good idea but a necessary one if running wordpress with the amount of posts and combined with the limitations of mysql not having a descending index function. Those file sorts caused by the order by operations are a deal breaker for us in regards to site performance. – Ranknoodle Jun 15 ’15 at 2:34 But these operations are slow since you’re doing it wrong. In some projects we had similar issue, but came to very different solution, that didn’t modify core tables. We’ve created our own table and used it as indexing/search table. So every slow query was searching only based on this one table (no joins needed). (And we had much more data, AFAIR) – Krzysiek Dróżdż♦ Jun 15 ’15 at 5:06 Hi KRZYSIEK can you explain a little more on indexing search tables that you created? For example the slow query outline in the original question, I would create a table to store the post ID,reverse_post_id,post_type etc and only query against that? – Ranknoodle Jun 15 ’15 at 16:31 Send me an e-mail, I’ll try to elaborate on that method. – Krzysiek Dróżdż♦ Jun 15 ’15 at 16:34

But no idea on the method he used.

Does a monk decide to use slow fall after damage is rolled?

At fourth level, monks get the class feature Slow Fall:

Slow Fall

Beginning at 4th level, you can use your reaction when you fall to reduce any falling damage you take by an amount equal to five times your monk level.

My question is, does a monk decide to use their reaction for slow fall before or after the falling damage is rolled?

Typically when slow fall opportunities have come up for me it doesn’t matter, I have nothing else to use a reaction for at the time so I will always use it even to negate just one damage. But recently a situation came up where I wanted to save the reaction for something else, but whether or not saving the reaction was worth it depended on how much damage I took from the fall.

My first inclination was that the monk must decide before fall damage is rolled, because other similar abilities that effect rolls explicitly say they may be used after the roll is made but before the outcome is determined and Slow Fall doesn’t say that.

But on further thinking I’m not sure that’s correct, because this isn’t affecting whether an outcome is a success or not. I could imagine a fall that lasted across two turns, a monk presumably cannot use Slow Fall during the first turn and expect the damage reduction to carry through to the second turn (when the fall ends), so it makes most sense that what you are reacting to is the end of the fall when damage is dealt, not the actual fall itself.

Which of these devices might slow down processor?

I have test question.

Which devices inside processor are used to speed up work indirectly i.e. program isn’t executing a code for that device?

Possible answers: DRAM | Cache | Pipeline | GPU | RAM | ARM | Stack | FPU

I think we can immediately say, that DRAM, GPU, & RAM is wrong picks, because they are not inside cpu – they are different parts of computer. Also stack is inside RAM, not CPU. So left answers are cache, pipeline, arm & fpu? Also not sure about floating point number.

Why is my algorithm version so slow with this input?

I’ve written my F# code to solve Advent of Code Day 18 Part 1. While it seems to work fine with other simple demo inputs, it stuck with the following input

################# #i.G..c...e..H.p# ########.######## #j.A..b...f..D.o# ########@######## #k.E..a...g..B.n# ########.######## #l.F..d...h..C.m# ################# 

Tehre is reference solution in Python which is correct and quick, but I fail to see where is the fundamental difference between the two algorithms, behind the other minor code differences (also because the languages are different).

I’ve tried with concurrency vs a queue, with a tree vs a grid/map (see my github history) but with no luck until now.

The principal part of the code is described below. It should fall under a breadth first search (BFS) algorithm.

Here is how the single step by which I elaborate the solution.

let next (step:Step) (i:int) (solution: Solution) (fullGrid: Map<char,Map<char,Grid>>) : Solution =     let branches = solution.tree.branches     let distance = solution.tree.distance + branches.[i].distance     let area = branches.[i].area       //let newbranches, back, keys =     match step with     | SpaceStep ->         failwith "not expected with smart grid"     | KeyStep ->         let keys = area :: solution.keys         let grid = fullGrid.[area]         let tree = grid2tree area distance keys grid         {keys=keys; tree=tree} 

The fullGrid is supposed to contain the matrix of distances. The wrapping solver is simply a recursion or queue based version of the BFS.

let findSolution (keynum:int) (solution: Solution) (fullGrid: Map<char,Map<char,Grid>>) : Solution option =     let mutable solution_queue : queue<Solution> = MyQueue.empty     solution_queue <- enqueue solution_queue solution     let mutable mindistance : int option = None     let mutable alternatives : Solution list = List.empty      while (MyQueue.length solution_queue > 0) do         let solution = dequeue &solution_queue         let solution = {solution with tree = grid2tree solution.tree.area solution.tree.distance solution.keys fullGrid.[solution.tree.area]}         let branches = solution.tree.branches         if  (branches = [||] ) then              if solution.keys.Length = keynum              then updateMin &mindistance &alternatives solution         else         match mindistance with         | Some d when d < solution.tree.distance + (solution.tree.branches |> Array.map (fun t -> t.distance) |> Array.min) -> ()          | _ ->         let indexes =             [|0..branches.Length-1|]             |> Array.sortBy(fun idx -> ((if isKey branches.[idx].area then 0 else 1) , branches.[idx].distance))         for i in indexes do             if branches.[i].area = '#' then                  failwith "not expected with smart grid"              else             if branches.[i].area = Space then                 failwith "not expected with smart grid"             else             if (Char.IsLower branches.[i].area) then                 let solutionNext = next KeyStep i solution fullGrid                 if solutionNext.keys.Length = keynum                 then  updateMin &mindistance &alternatives solutionNext                 else                 solution_queue <- enqueue solution_queue solutionNext             else             if (Char.IsUpper branches.[i].area) then                 failwith "not expected with smart grid"      match alternatives with     | [] -> None     | alternatives ->         alternatives |> List.minBy(fun a -> a.tree.distance) |> Some 

What is the best way to host a site with many images without it being too slow?

I have a friend that wants me to help them with their WordPress website that has about 150 images for their gallery. Their site is quite slow even after I optimized the images using the ImageOptim app. They are using SiteGround as their web host provider, but they are only using the StartUp package because it is the most affordable. I know that the site is slow to load because of the images, but not sure what the best approach is to try and speed it up without paying for a more expensive hosting package.

I am thinking that perhaps the best way to go about doing this would be to have them just put their images on Google Images and use that as their gallery instead, or maybe an Instagram feed like Smash Balloon.

What would you all suggest?


D&D 5e Slow Spell

We had a little problem last session. So heres the scenario. There are enemys in a darkness spell that that player has never seen but heard. So he casts the effect of Slow on the area which includes the monsters. Now my question is how this works exactly. are these creatures affected or not since he doesnt know that they are there.