means that
someone wastes time or energy on a method that cannot achieve the intended purpose.
also
Like pouring water into a sieve.
Imagine a case where someone spends time or energy trying to do something that is useless; then “To pour water into a sieve” fits well.