It would last approximately 3 months, not 3 seconds as suggested by the widely spread legend.
Originally, goldfish can measure up to 30cm and live for many decades. More intelligent than we think, they are also sensitive to colors and sounds. But small jars, too small in relation to their needs, prevent them from developing properly and make them look bored.
Rest assured: 3 months is still not very long. So you can continue to use the phrase “You have a memory of goldfish”!