I have 2 temporary tables # temp1 and #temp. Both have columns of keys and dates. Both have about 25 thousand lines. And I joined them based on a key and a date that are unique to all rows. It takes about 4 minutes to complete this connection. Is there any way to speed it up or any alternative methods?
I believe that you can create indexes in temporary tables, as in any other tables.
If your join of the tables 25ktakes 4minutes, something is wrong with it.
25k
4
JOIN, ( - ), 25k * 25k = 625M.
JOIN
25k * 25k = 625M
4 , , , , .
, DISTINCT/GROUP BY, , .
DISTINCT
GROUP BY
, ?
, . , .
?
depending on what you are doing, you might be able to avoid temp tables altogether and have a set-based solution (which will work much faster and better), but it's hard to understand, even if you don't know.
Source: https://habr.com/ru/post/1715967/More articles:Are there any Javascript Chart libraries that make scatterplots? - javascriptmath expression analyzer in Delphi? - mathData schema for complex objects - which approach is simpler - database-designFirebird alias names - delphiParsing a string formula with an integer result - stringRounding floats with inaccurate representation - cInsert from MS SQL to Lotus Notes using a NotesSQL disk - sql-serversearch for similar offers in mysql - mysqlMakefile can't understand comments - linuxMute replacement of selenium and batira for testing Rails and Merb - ruby-on-railsAll Articles